diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2025-01-06 15:19:21 -0500 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2025-01-06 15:19:21 -0500 |
| commit | 3bd9d0d06f7d02c4f968e7679c80a2e53aa76afc (patch) | |
| tree | ef2ae023d77c14ffb16a52ab805ffb45cd8df786 /pkmem.h | |
| parent | cb05cc6267cd6915d2b8f90f159adb1e09802e62 (diff) | |
pkmem: pk_bucket_head indexing + more mem tests
Diffstat (limited to 'pkmem.h')
| -rw-r--r-- | pkmem.h | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -210,13 +210,12 @@ pk_memory_debug_print() void pk_memory_flush() { - for (long i = pk_bucket_head - 2; i > -1; --i) { + for (long i = pk_bucket_head - 1; i > -1; --i) { if (pk_buckets[i].head != 0) break; - if (pk_buckets[i+1].head != 0) break; if (pk_buckets[i].transient == true) break; - if (pk_buckets[i+1].transient == true) break; pk_bucket_head--; - pk_bucket_destroy(&pk_buckets[i + 1]); + if (pk_buckets[i].raw == CAFE_BABE(void)) continue; + pk_bucket_destroy(&pk_buckets[i]); } } @@ -225,6 +224,7 @@ pk_memory_teardown_all() { for (int64_t i = pk_bucket_head; i > 0; --i) { if (pk_buckets[i - 1].ptr == nullptr) continue; + if (pk_buckets[i - 1].ptr == CAFE_BABE(char)) continue; pk_bucket_destroy(&pk_buckets[i - 1]); } pk_bucket_head = 0; @@ -281,7 +281,7 @@ pk_bucket_destroy(struct pk_membucket* bkt) int64_t i; for (i = 0; i < pk_bucket_head; ++i) { if (&pk_buckets[i] == bkt) { - if (pk_bucket_head == i) + if (pk_bucket_head == i + 1) pk_bucket_head--; break; } |
