Skip to content

Commit

Permalink
fix armv7 build warning, only show memory leak if so
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTechsTech committed Sep 26, 2024
1 parent 275cc0b commit fce3521
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8...3.14)

project(
rpmalloc
VERSION 2.0.22
VERSION 2.1.0
DESCRIPTION "General Purpose Memory Allocator"
HOMEPAGE_URL "https://github.com/zelang-dev/rpmalloc"
LANGUAGES C
Expand Down
5 changes: 3 additions & 2 deletions rpmalloc/rpmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ static FORCEINLINE void *atomic_load_ptr(atomic_ptr_t *src) { return (void *)c89
static FORCEINLINE void atomic_store_ptr(atomic_ptr_t *dst, void *val) { c89atomic_store_explicit_64((volatile c89atomic_uint64 *)dst, (c89atomic_uint64)val, memory_order_relaxed); }
static FORCEINLINE void atomic_store_ptr_release(atomic_ptr_t *dst, void *val) { c89atomic_store_explicit_64((volatile c89atomic_uint64 *)dst, (c89atomic_uint64)val, memory_order_release); }
static FORCEINLINE void *atomic_exchange_ptr_acquire(atomic_ptr_t *dst, void *val) { return (void *)c89atomic_exchange_explicit_64((volatile c89atomic_uint64 *)dst, (c89atomic_uint64)val, memory_order_acquire); }
static FORCEINLINE int atomic_cas_ptr(atomic_ptr_t *dst, void *val, void *ref) { return (int)atomic_swap((volatile c89atomic_uint64 *)dst, (c89atomic_uint64 *)&ref, (c89atomic_uint64)val); }
static FORCEINLINE int atomic_cas_ptr(atomic_ptr_t *dst, void *val, void *ref) { return (int)atomic_swap(dst, &ref, (c89atomic_uint64)val); }

#if defined(__TINYC__) || !defined(_WIN32)
int rpmalloc_tls_create(tls_t *key, tls_dtor_t dtor) {
Expand Down Expand Up @@ -1356,7 +1356,8 @@ _rpmalloc_span_finalize(heap_t * heap, size_t iclass, span_t * span, span_t * *l
}
//If this assert triggers you have memory leaks
#if defined(ENABLE_ASSERTS)
printf("memory freed: %d, memory used: %d\n", span->list_size, span->used_count);
if (span->list_size != span->used_count)
printf("memory freed: %d, memory used: %d: heap: %p\n", span->list_size, span->used_count, free_list);
#endif
if (_rpmalloc_shuting_down == 0)
rpmalloc_assert(span->list_size == span->used_count, "Memory leak detected");
Expand Down

0 comments on commit fce3521

Please sign in to comment.