fixing subtle bug where heapsize was set wrong at some points

This commit is contained in:
JeffBezanson 2010-07-06 23:13:54 +00:00
parent 8ea6157c15
commit 561e0b07e1
1 changed files with 6 additions and 5 deletions

View File

@ -529,7 +529,10 @@ void gc(int mustgrow)
fl_readstate_t *rs;
curheap = tospace;
lim = curheap+heapsize-sizeof(cons_t);
if (grew)
lim = curheap+heapsize*2-sizeof(cons_t);
else
lim = curheap+heapsize-sizeof(cons_t);
if (fl_throwing_frame > curr_frame) {
top = fl_throwing_frame - 4;
@ -584,14 +587,12 @@ void gc(int mustgrow)
// more space to fill next time. if we grew tospace last time,
// grow the other half of the heap this time to catch up.
if (grew || ((lim-curheap) < (int)(heapsize/5)) || mustgrow) {
temp = LLT_REALLOC(tospace, grew ? heapsize : heapsize*2);
temp = LLT_REALLOC(tospace, heapsize*2);
if (temp == NULL)
fl_raise(memory_exception_value);
tospace = temp;
if (!grew) {
if (grew) {
heapsize*=2;
}
else {
temp = bitvector_resize(consflags, heapsize/sizeof(cons_t), 1);
if (temp == NULL)
fl_raise(memory_exception_value);