summaryrefslogtreecommitdiffstats
path: root/gc.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-06-07 06:14:05 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-06-07 06:14:05 -0700
commitca0bcafd671f24481441bb7e9b30293758fe032b (patch)
tree34e6cdf24b6ec5a3e89f0b85fb8eed69e8a7c62d /gc.h
parente1e8eedfd994463db4a3db048117c4bcd9aaf416 (diff)
downloadtxr-ca0bcafd671f24481441bb7e9b30293758fe032b.tar.gz
txr-ca0bcafd671f24481441bb7e9b30293758fe032b.tar.bz2
txr-ca0bcafd671f24481441bb7e9b30293758fe032b.zip
New --free-all option for freeing memory on exit.
Although we are garbage-collected, being able to clean up on shutdown is nevertheless useful for uncovering leaks. Leaks can occur, for instance, due to neglect to free out-of-heap satellite data from objects that are reclaimed by gc. This feature is long overdue. * arith.c, arith.h (arith_free_all): New function. * gc.c, gc.h (gc_free_all): New function. * lib.c (init): Remove program name parameter and redundant initialization of progname globl variable. * lib.h (progname): Superfluous declaration removed. This is already declared in txr.h. (init): Declaration updated. * regex.c (char_set_destroy): Do not check the static allocation flag here; just destroy the object. Do check for a null pointer, though. (char_set_cobj_destroy): This cobj destructor now checks the static flag of the char set object and avoids freeing it. Thus our char set singletons are left alone by gc, but our global freeing function takes care of them. (wide_cs): New static variable moved out of wide_display_char_p to static scope. (regex_free_all): New function. * regex.h (regex_free_all): Declared. * txr.c (progname): const qualifier and initializer removed. (main): Ensure progname is always dynamically allocated, even in the argv[0] == 0 case. Do not pass progname to init; it doesn't take that argument any more. (free_all): New static function. (txr_main): Implement --free-all option. * txr.h (progname): Declaration updated.
Diffstat (limited to 'gc.h')
-rw-r--r--gc.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/gc.h b/gc.h
index a879ad6a..27c534f9 100644
--- a/gc.h
+++ b/gc.h
@@ -48,6 +48,7 @@ extern int full_gc;
void unmark(void);
void gc_hint_func(val *);
void gc_report_copies(val *pvar);
+void gc_free_all(void);
extern int gc_enabled;
extern val **gc_prot_top;