summaryrefslogtreecommitdiff
path: root/test/pkmem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/pkmem.cpp')
-rw-r--r--test/pkmem.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/pkmem.cpp b/test/pkmem.cpp
index 52b393b..c19b71d 100644
--- a/test/pkmem.cpp
+++ b/test/pkmem.cpp
@@ -122,6 +122,7 @@ const char *test_bucket_count02 = "test_bucket_count02";
const char *test_bucket_count03 = "test_bucket_count03";
const char *test_bucket_count04 = "test_bucket_count04";
const char *test_bucket_count05 = "test_bucket_count05";
+const char *test_generic_01 = "test_generic_01";
void pk_test_pkmem_spinup(bool init_funcinstr = false) {
if (init_funcinstr) pk_funcinstr_init();
@@ -648,5 +649,21 @@ int main(int argc, char *argv[])
fprintf(stdout, "[pkmem.cpp] end: %s\n\n", test_alloc_strings);
pk_test_pkmem_teardown();
+ // ensures that pk_delete resets the bkt when alloc_count falls to 0
+ pk_test_pkmem_spinup();
+ fprintf(stdout, "[pkmem.cpp] start: %s\n", test_generic_01);
+ {
+ pk_membucket *bkt = pk_mem_bucket_create(test_free_between, PK_MEM_DEFAULT_BUCKET_SIZE, PK_MEMBUCKET_FLAG_NONE);
+
+ float *flts1 = pk_new<float>(48000, bkt);
+ pk_delete<float>(flts1, 48000, bkt);
+ float *flts2 = pk_new<float>(48000, bkt);
+ pk_delete<float>(flts2, 48000, bkt);
+
+ pk_mem_bucket_destroy(bkt);
+ }
+ fprintf(stdout, "[pkmem.cpp] end: %s\n\n", test_alloc_strings);
+ pk_test_pkmem_teardown();
+
return 0;
}