Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
cmucl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Carl Shapiro
cmucl
Commits
5945911a
Commit
5945911a
authored
34 years ago
by
wlott
Browse files
Options
Downloads
Patches
Plain Diff
Added stuff to automatically trigger a GC when we exceed *gc-trigger*.
parent
6aa36c59
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
code/gc.lisp
+24
-7
24 additions, 7 deletions
code/gc.lisp
with
24 additions
and
7 deletions
code/gc.lisp
+
24
−
7
View file @
5945911a
...
...
@@ -8,7 +8,7 @@
;;; Scott Fahlman (Scott.Fahlman@CS.CMU.EDU).
;;; **********************************************************************
;;;
;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/gc.lisp,v 1.
4
1990/
08/24 18:11:14
wlott Exp $
;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/gc.lisp,v 1.
5
1990/
10/13 04:51:06
wlott Exp $
;;;
;;; Garbage collection and allocation related code.
;;;
...
...
@@ -150,9 +150,10 @@
;;; Internal trigger. When the dynamic usage increases beyond this
;;; amount, the system notes that a garbage collection needs to occur by
;;; setting *NEED-TO-COLLECT-GARBAGE* to T.
;;; setting *NEED-TO-COLLECT-GARBAGE* to T. It starts out as NIL meaning
;;; nobody has figured out what it should be yet.
;;;
(
defvar
*gc-trigger*
default-bytes-consed-between-gcs
)
(
defvar
*gc-trigger*
nil
)
;;;
...
...
@@ -255,6 +256,14 @@
(
def-c-routine
(
"collect_garbage"
collect-garbage
)
(
int
))
(
def-c-routine
(
"set_auto_gc_trigger"
set-auto-gc-trigger
)
(
void
)
(
dynamic-usage
unsigned-long
))
(
def-c-routine
(
"clear_auto_gc_trigger"
clear-auto-gc-trigger
)
(
void
))
(
defun
%gc
()
(
let
((
old-usage
(
dynamic-usage
)))
(
collect-garbage
)
...
...
@@ -303,10 +312,11 @@
(
warn
"The value of *BYTES-CONSED-BETWEEN-GCS*, ~S, is not an ~
integer. Reseting it to 2000000"
*bytes-consed-between-gcs*
)
(
setf
*bytes-consed-between-gcs*
default-bytes-consed-between-gcs
))
(
when
(
>
*bytes-consed-between-gcs*
*gc-trigger*
)
(
setf
*gc-trigger*
*bytes-consed-between-gcs*
))
(
when
(
>
pre-gc-dyn-usage
*gc-trigger*
)
(
setf
*need-to-collect-garbage*
t
))
(
when
*gc-trigger*
(
when
(
>
*bytes-consed-between-gcs*
*gc-trigger*
)
(
setf
*gc-trigger*
*bytes-consed-between-gcs*
))
(
when
(
>
pre-gc-dyn-usage
*gc-trigger*
)
(
setf
*need-to-collect-garbage*
t
)))
(
when
(
or
force-p
(
and
*need-to-collect-garbage*
(
not
*gc-inhibit*
)))
(
setf
*gc-inhibit*
t
)
; Set *GC-INHIBIT* to T before calling the hook
...
...
@@ -320,12 +330,15 @@
(
carefully-funcall
*gc-notify-before*
pre-gc-dyn-usage
))
(
dolist
(
hook
*before-gc-hooks*
)
(
carefully-funcall
hook
))
(
when
*gc-trigger*
(
clear-auto-gc-trigger
))
(
funcall
*internal-gc*
)
(
let*
((
post-gc-dyn-usage
(
dynamic-usage
))
(
bytes-freed
(
-
pre-gc-dyn-usage
post-gc-dyn-usage
)))
(
setf
*need-to-collect-garbage*
nil
)
(
setf
*gc-trigger*
(
+
post-gc-dyn-usage
*bytes-consed-between-gcs*
))
(
set-auto-gc-trigger
*gc-trigger*
)
(
dolist
(
hook
*after-gc-hooks*
)
(
carefully-funcall
hook
))
(
when
verbose-p
...
...
@@ -359,9 +372,13 @@
;;;; Auxiliary Functions.
(
defun
gc-on
()
"Enables the garbage collector."
(
setq
*gc-inhibit*
nil
)
(
unless
*gc-trigger*
(
setf
*gc-trigger*
*bytes-consed-between-gcs*
)
(
set-auto-gc-trigger
*gc-trigger*
))
(
when
*need-to-collect-garbage*
(
sub-gc
*gc-verbose*
nil
))
nil
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment