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