diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2009-11-01 09:15:04 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2009-11-01 09:15:04 -0800 |
commit | 04ed380c4a389c0c21eae8e3cd35e7e44506a2e3 (patch) | |
tree | 18f2c304931497d21767eb37050b1753091623eb /lib.c | |
parent | dd40488f746cab80f33a4a30508afc4d7ace1516 (diff) | |
download | txr-04ed380c4a389c0c21eae8e3cd35e7e44506a2e3.tar.gz txr-04ed380c4a389c0c21eae8e3cd35e7e44506a2e3.tar.bz2 txr-04ed380c4a389c0c21eae8e3cd35e7e44506a2e3.zip |
Bug ID 27899: Garbage collection problem: method of locating stack
bottom is unreliable due to the unpredictable allocation order of local
variables.
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 19 |
1 files changed, 3 insertions, 16 deletions
@@ -1949,26 +1949,13 @@ void obj_pprint(obj_t *obj, obj_t *out) } void init(const char *pn, void *(*oom)(void *, size_t), - obj_t **maybe_bottom_0, obj_t **maybe_bottom_1) + obj_t **stack_bottom) { - int growsdown; - obj_t *local_bottom = nil; progname = pn; int gc_save = gc_state(0); - /* If the local_bottom variable has a smaller address than - either of the two possible top variables from - the initializing function, then the stack grows - downward in memory. In that case, we take the - greater of the two values to be the top. - Otherwise we take the smaller of the two values. */ - - growsdown = &local_bottom < maybe_bottom_0; - - gc_init(growsdown - ? max(maybe_bottom_0, maybe_bottom_1) - : min(maybe_bottom_0, maybe_bottom_1)); - + oom_realloc = oom; + gc_init(stack_bottom); obj_init(); uw_init(); stream_init(); |