We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
umfPoolMallocUsableSize
1 parent 64456b7 commit c1ba4b0Copy full SHA for c1ba4b0
test/poolFixtures.hpp
@@ -456,4 +456,22 @@ TEST_P(umfPoolTest, allocMaxSize) {
456
ASSERT_EQ(ptr, nullptr);
457
}
458
459
+// Sanitizer replaces malloc_usable_size implementation with it's own,
460
+// what results in a failure.
461
+#ifndef __SANITIZE_ADDRESS__
462
+TEST_P(umfPoolTest, mallocUsableSize) {
463
+ for (size_t allocSize : {32, 48, 1024, 8192}) {
464
+ char *ptr = static_cast<char *>(umfPoolMalloc(pool.get(), allocSize));
465
+ size_t result = umfPoolMallocUsableSize(pool.get(), ptr);
466
+ EXPECT_TRUE(result == 0 or result >= allocSize);
467
+
468
+ for (size_t i = 0; i < result; i++) {
469
+ ptr[i] = 123;
470
+ }
471
472
+ umfPoolFree(pool.get(), ptr);
473
474
+}
475
+#endif
476
477
#endif /* UMF_TEST_POOL_FIXTURES_HPP */
0 commit comments