Skip to content

Commit 5259529

Browse files
NickBarnesjvanburen
authored andcommittedMar 11, 2025
Remove incorrect debug-only accounting code (and rename a function) (#3676)
Remove incorrect debug-only accounting code (and rename a function).
1 parent dc108cc commit 5259529

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed
 

‎runtime/minor_gc.c

+5-9
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,7 @@ static void custom_finalize_minor (caml_domain_state * domain)
852852
}
853853
}
854854

855-
static void dependent_finalize_minor (caml_domain_state *domain)
855+
static void dependent_accounting_minor (caml_domain_state *domain)
856856
{
857857
struct caml_dependent_elt *elt;
858858
for (elt = domain->minor_tables->dependent.base;
@@ -861,20 +861,16 @@ static void dependent_finalize_minor (caml_domain_state *domain)
861861
CAMLassert (Is_block (*v));
862862
if (Is_young(*v)) {
863863
if (get_header_val(*v) == 0) { /* value copied to major heap */
864-
#ifdef DEBUG
865-
domain->minor_dependent_bsz -= elt->mem;
866-
/* see assertion below */
867-
#endif
868864
/* inlined version of [caml_alloc_dependent_memory] */
869865
domain->allocated_dependent_bytes += elt->mem;
870866
domain->stat_promoted_dependent_bytes += elt->mem;
871867
caml_add_dependent_bytes (domain->shared_heap, elt->mem);
872868
}
873869
}
874870
}
875-
/* At this point, everything must be finalized or promoted. */
876-
CAMLassert (domain->minor_dependent_bsz == 0);
877-
domain->minor_dependent_bsz = 0;
871+
/* Don't touch minor_dependent_bsz() as it's outside our control
872+
(controlled by caml_alloc/free_dependent_memory). It's cleared
873+
at the end of the collection. */
878874
}
879875

880876
/* Increment the counter non-atomically, when it is already known that this
@@ -990,7 +986,7 @@ caml_stw_empty_minor_heap_no_major_slice(caml_domain_state* domain,
990986

991987
CAML_EV_BEGIN(EV_MINOR_DEPENDENT);
992988
caml_gc_log("accounting for minor blocks with dependent memory");
993-
dependent_finalize_minor(domain);
989+
dependent_accounting_minor(domain);
994990
CAML_EV_END(EV_MINOR_DEPENDENT);
995991

996992
CAML_EV_BEGIN(EV_MINOR_FINALIZERS_ADMIN);

0 commit comments

Comments
 (0)