mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-06 14:58:50 +00:00
Fix GC bug: add swap spaces when extend; Fix debug info
This commit is contained in:
parent
ff197744f6
commit
dfa1380262
1 changed files with 8 additions and 3 deletions
|
|
@ -1443,6 +1443,7 @@ static void * gc (size_t size) {
|
|||
fflush (stdout);
|
||||
#endif
|
||||
if (extend_spaces ()) {
|
||||
gc_swap_spaces ();
|
||||
init_to_space (1);
|
||||
return gc (size);
|
||||
}
|
||||
|
|
@ -1560,13 +1561,17 @@ extern void * alloc (size_t size) {
|
|||
#endif
|
||||
return p;
|
||||
}
|
||||
init_to_space (0);
|
||||
#ifdef DEBUG_PRINT
|
||||
printf ("alloc: call gc: %zu\n", size); fflush (stdout);
|
||||
printFromSpace(); fflush (stdout);
|
||||
printf("gc END\n\n"); fflush (stdout);
|
||||
p = gc (size);
|
||||
printf("gc END %p %p %p\n\n", from_space.begin,
|
||||
from_space.end, from_space.current); fflush (stdout);
|
||||
printFromSpace(); fflush (stdout);
|
||||
#endif
|
||||
init_to_space (0);
|
||||
return p;
|
||||
#else
|
||||
return gc (size);
|
||||
#endif
|
||||
}
|
||||
# endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue