Skip to content

Commit 9c90d2c

Browse files
committed
Merge pull request #14104 from JuliaLang/kf/fixmemdebug
Fix MEMDEBUG mode
2 parents e123918 + 60f57a6 commit 9c90d2c

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

src/gc.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,7 @@ static inline int gc_setmark_big(void *o, int mark_mode)
605605
return 0;
606606
}
607607
#endif
608+
assert(find_region(o,1) == NULL);
608609
bigval_t* hdr = bigval_header(o);
609610
int bits = gc_bits(o);
610611
if (bits == GC_QUEUED || bits == GC_MARKED)
@@ -1087,6 +1088,9 @@ static NOINLINE void add_page(pool_t *p)
10871088

10881089
static inline void *__pool_alloc(pool_t* p, int osize, int end_offset)
10891090
{
1091+
#ifdef MEMDEBUG
1092+
assert(0 && "Should not be using pools in MEMDEBUG mode");
1093+
#endif
10901094
gcval_t *v, *end;
10911095
// FIXME - need JL_ATOMIC_FETCH_AND_ADD here
10921096
if (__unlikely((allocd_bytes += osize) >= 0) || gc_debug_check_pool()) {
@@ -2370,9 +2374,10 @@ DLLEXPORT jl_value_t *jl_gc_alloc_0w(void)
23702374
void *tag = NULL;
23712375
#ifdef MEMDEBUG
23722376
tag = alloc_big(sz);
2373-
#endif
2377+
#else
23742378
FOR_CURRENT_HEAP ()
23752379
tag = _pool_alloc(&pools[szclass(sz)], sz);
2380+
#endif
23762381
return jl_valueof(tag);
23772382
}
23782383

@@ -2382,9 +2387,10 @@ DLLEXPORT jl_value_t *jl_gc_alloc_1w(void)
23822387
void *tag = NULL;
23832388
#ifdef MEMDEBUG
23842389
tag = alloc_big(sz);
2385-
#endif
2390+
#else
23862391
FOR_CURRENT_HEAP ()
23872392
tag = _pool_alloc(&pools[szclass(sz)], sz);
2393+
#endif
23882394
return jl_valueof(tag);
23892395
}
23902396

@@ -2394,9 +2400,10 @@ DLLEXPORT jl_value_t *jl_gc_alloc_2w(void)
23942400
void *tag = NULL;
23952401
#ifdef MEMDEBUG
23962402
tag = alloc_big(sz);
2397-
#endif
2403+
#else
23982404
FOR_CURRENT_HEAP ()
23992405
tag = _pool_alloc(&pools[szclass(sz)], sz);
2406+
#endif
24002407
return jl_valueof(tag);
24012408
}
24022409

@@ -2406,9 +2413,10 @@ DLLEXPORT jl_value_t *jl_gc_alloc_3w(void)
24062413
void *tag = NULL;
24072414
#ifdef MEMDEBUG
24082415
tag = alloc_big(sz);
2409-
#endif
2416+
#else
24102417
FOR_CURRENT_HEAP ()
24112418
tag = _pool_alloc(&pools[szclass(sz)], sz);
2419+
#endif
24122420
return jl_valueof(tag);
24132421
}
24142422

src/init.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ static void jl_find_stack_bottom(void)
9696
#ifndef _OS_WINDOWS_
9797
struct rlimit rl;
9898

99-
// When using memory sanitizer, increase stack size because msan bloats stack usage
99+
// When using the sanitizers, increase stack size because they bloat stack usage
100100
#if defined(__has_feature)
101-
#if __has_feature(memory_sanitizer)
101+
#if __has_feature(memory_sanitizer) || __has_feature(address_sanitizer)
102102
const rlim_t kStackSize = 32 * 1024 * 1024; // 32MB stack
103103
int result;
104104

0 commit comments

Comments
 (0)