diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-06-07 06:14:05 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-06-07 06:14:05 -0700 |
commit | ca0bcafd671f24481441bb7e9b30293758fe032b (patch) | |
tree | 34e6cdf24b6ec5a3e89f0b85fb8eed69e8a7c62d /arith.h | |
parent | e1e8eedfd994463db4a3db048117c4bcd9aaf416 (diff) | |
download | txr-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 'arith.h')
-rw-r--r-- | arith.h | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -41,3 +41,4 @@ val tofloat(val obj); val toint(val obj, val base); val width(val num); void arith_init(void); +void arith_free_all(void); |