File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 8
8
#include " pool.hpp"
9
9
#include " poolFixtures.hpp"
10
10
11
+ using umf_test::test;
12
+ using namespace umf_test ;
13
+
11
14
auto defaultParams = umfOsMemoryProviderParamsDefault();
12
15
INSTANTIATE_TEST_SUITE_P (jemallocPoolTest, umfPoolTest,
13
16
::testing::Values (poolCreateExtParams{
14
17
&UMF_JEMALLOC_POOL_OPS, nullptr ,
15
18
&UMF_OS_MEMORY_PROVIDER_OPS, &defaultParams}));
19
+
20
+ TEST_F (test, metadataNotAllocatedUsingProvider) {
21
+ static constexpr size_t allocSize = 1024 ;
22
+ static constexpr size_t numAllocs = 1024 ;
23
+
24
+ // set coarse grain allocations to PROT_NONE so that we can be sure
25
+ // jemalloc does not touch any of the allocated memory
26
+ auto params = umfOsMemoryProviderParamsDefault ();
27
+ params.protection = UMF_PROTECTION_NONE;
28
+
29
+ auto pool = poolCreateExtUnique ({&UMF_JEMALLOC_POOL_OPS, nullptr ,
30
+ &UMF_OS_MEMORY_PROVIDER_OPS, ¶ms});
31
+
32
+ std::vector<std::shared_ptr<void >> allocs;
33
+ for (size_t i = 0 ; i < numAllocs; i++) {
34
+ allocs.emplace_back (
35
+ umfPoolMalloc (pool.get (), allocSize),
36
+ [pool = pool.get ()](void *ptr) { umfPoolFree (pool, ptr); });
37
+ }
38
+ }
You can’t perform that action at this time.
0 commit comments