fix memory accounting with ephemerons and dead threads
svn: r5757
This commit is contained in:
parent
cd3fe00778
commit
db2822daa7
|
@ -1216,9 +1216,11 @@ inline static void mark_threads(int owner)
|
|||
|
||||
for(work = threads; work; work = work->next)
|
||||
if(work->owner == owner) {
|
||||
normal_thread_mark(work->thread);
|
||||
if (work->thread == scheme_current_thread) {
|
||||
GC_mark_variable_stack(GC_variable_stack, 0, gc_stack_base);
|
||||
if (((Scheme_Thread *)work->thread)->running) {
|
||||
normal_thread_mark(work->thread);
|
||||
if (work->thread == scheme_current_thread) {
|
||||
GC_mark_variable_stack(GC_variable_stack, 0, gc_stack_base);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1657,6 +1659,7 @@ static void do_btc_accounting(void)
|
|||
}
|
||||
mark_table[scheme_thread_type] = &BTC_thread_mark;
|
||||
mark_table[scheme_custodian_type] = &BTC_custodian_mark;
|
||||
mark_table[ephemeron_tag] = btc_mark_ephemeron;
|
||||
|
||||
/* clear the memory use numbers out */
|
||||
for(i = 1; i < owner_table_top; i++)
|
||||
|
@ -1686,6 +1689,7 @@ static void do_btc_accounting(void)
|
|||
|
||||
mark_table[scheme_thread_type] = normal_thread_mark;
|
||||
mark_table[scheme_custodian_type] = normal_custodian_mark;
|
||||
mark_table[ephemeron_tag] = mark_ephemeron;
|
||||
in_unsafe_allocation_mode = 0;
|
||||
doing_memory_accounting = 0;
|
||||
old_btc_mark = new_btc_mark;
|
||||
|
@ -1774,8 +1778,6 @@ static unsigned long custodian_super_require(void *c)
|
|||
unsigned long req = 0, r;
|
||||
struct account_hook *work = hooks;
|
||||
|
||||
printf("check: %p\n", c);
|
||||
|
||||
while(work) {
|
||||
if ((work->type == MZACCT_REQUIRE) && (c == work->c2)) {
|
||||
r = work->amount + custodian_super_require(work->c1);
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
init_weak_boxes zero_weak_boxes
|
||||
GC_malloc_ephemeron
|
||||
size_ephemeron, mark_ephemeron, fixup_ephemeron
|
||||
btc_mark_ephemeron [ifdef NEW_BTC_ACCOUNT]
|
||||
init_ephemerons mark_ready_ephemerons zero_remaining_ephemerons
|
||||
num_last_seen_ephemerons
|
||||
Requires:
|
||||
|
@ -266,6 +267,19 @@ static int mark_ephemeron(void *p)
|
|||
return gcBYTES_TO_WORDS(sizeof(GC_Ephemeron));
|
||||
}
|
||||
|
||||
#ifdef NEWGC_BTC_ACCOUNT
|
||||
static int btc_mark_ephemeron(void *p)
|
||||
{
|
||||
GC_Ephemeron *eph = (GC_Ephemeron *)p;
|
||||
|
||||
gcMARK(eph->key);
|
||||
gcMARK(eph->val);
|
||||
|
||||
return gcBYTES_TO_WORDS(sizeof(GC_Ephemeron));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static int fixup_ephemeron(void *p)
|
||||
{
|
||||
GC_Ephemeron *eph = (GC_Ephemeron *)p;
|
||||
|
|
Loading…
Reference in New Issue
Block a user