summaryrefslogtreecommitdiffstats
path: root/test/unit/base.c
diff options
context:
space:
mode:
authorQi Wang <interwq@gwu.edu>2018-05-08 19:12:50 (GMT)
committerQi Wang <interwq@gwu.edu>2018-05-08 19:12:50 (GMT)
commit61efbda7098de6fe64c362d309824864308c36d4 (patch)
tree62b8cec5495df891b28fbb139b0c01cdbf9f3fb3 /test/unit/base.c
parent3f5049340e66c6929c3270f7359617f62e053b11 (diff)
parent1c51381b7cc62b6e0e77d02c42925c3776dbc4a2 (diff)
downloadjemalloc-5.1.0.zip
jemalloc-5.1.0.tar.gz
jemalloc-5.1.0.tar.bz2
Merge branch 'dev'5.1.0
Diffstat (limited to 'test/unit/base.c')
-rw-r--r--test/unit/base.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/test/unit/base.c b/test/unit/base.c
index 7fa24ac..6b792cf 100644
--- a/test/unit/base.c
+++ b/test/unit/base.c
@@ -28,22 +28,28 @@ static extent_hooks_t hooks_not_null = {
TEST_BEGIN(test_base_hooks_default) {
base_t *base;
- size_t allocated0, allocated1, resident, mapped;
+ size_t allocated0, allocated1, resident, mapped, n_thp;
tsdn_t *tsdn = tsd_tsdn(tsd_fetch());
base = base_new(tsdn, 0, (extent_hooks_t *)&extent_hooks_default);
if (config_stats) {
- base_stats_get(tsdn, base, &allocated0, &resident, &mapped);
+ base_stats_get(tsdn, base, &allocated0, &resident, &mapped,
+ &n_thp);
assert_zu_ge(allocated0, sizeof(base_t),
"Base header should count as allocated");
+ if (opt_metadata_thp == metadata_thp_always) {
+ assert_zu_gt(n_thp, 0,
+ "Base should have 1 THP at least.");
+ }
}
assert_ptr_not_null(base_alloc(tsdn, base, 42, 1),
"Unexpected base_alloc() failure");
if (config_stats) {
- base_stats_get(tsdn, base, &allocated1, &resident, &mapped);
+ base_stats_get(tsdn, base, &allocated1, &resident, &mapped,
+ &n_thp);
assert_zu_ge(allocated1 - allocated0, 42,
"At least 42 bytes were allocated by base_alloc()");
}
@@ -55,7 +61,7 @@ TEST_END
TEST_BEGIN(test_base_hooks_null) {
extent_hooks_t hooks_orig;
base_t *base;
- size_t allocated0, allocated1, resident, mapped;
+ size_t allocated0, allocated1, resident, mapped, n_thp;
extent_hooks_prep();
try_dalloc = false;
@@ -71,16 +77,22 @@ TEST_BEGIN(test_base_hooks_null) {
assert_ptr_not_null(base, "Unexpected base_new() failure");
if (config_stats) {
- base_stats_get(tsdn, base, &allocated0, &resident, &mapped);
+ base_stats_get(tsdn, base, &allocated0, &resident, &mapped,
+ &n_thp);
assert_zu_ge(allocated0, sizeof(base_t),
"Base header should count as allocated");
+ if (opt_metadata_thp == metadata_thp_always) {
+ assert_zu_gt(n_thp, 0,
+ "Base should have 1 THP at least.");
+ }
}
assert_ptr_not_null(base_alloc(tsdn, base, 42, 1),
"Unexpected base_alloc() failure");
if (config_stats) {
- base_stats_get(tsdn, base, &allocated1, &resident, &mapped);
+ base_stats_get(tsdn, base, &allocated1, &resident, &mapped,
+ &n_thp);
assert_zu_ge(allocated1 - allocated0, 42,
"At least 42 bytes were allocated by base_alloc()");
}