[PATCH] D66231: [scudo][standalone] Fix malloc_iterate

Mitch Phillips via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 14 11:19:11 PDT 2019


hctim added inline comments.


================
Comment at: lib/scudo/standalone/tests/wrappers_c_test.cpp:260
+// Verify that a block located on an iteration boundary is not mis-accounted.
+TEST(ScudoWrappersCTest, MallocIterateBoundary) {
+  const size_t BlockDelta = FIRST_32_SECOND_64(8U, 16U);
----------------
`BoundaryP` and `Counter` should be zeroed in the initialisation sequence for this test to make it end-to-end.


================
Comment at: lib/scudo/standalone/tests/wrappers_c_test.cpp:265
+
+  std::vector<void *> V;
+  while (V.size() < 512U) {
----------------
Nit: `std::vector<std::unique_ptr>`? to avoid manual cleanup later.


================
Comment at: lib/scudo/standalone/tests/wrappers_c_test.cpp:266
+  std::vector<void *> V;
+  while (V.size() < 512U) {
+    void *P = malloc(SpecialSize);
----------------
>From what I see, it looks like the goal of this loop is to (hopefully) get a page-aligned allocation. All the other allocations seem to not be important.

Could this test be simplified by guaranteeing a page-aligned pointer through `pvalloc()`? 


Repository:
  rCRT Compiler Runtime

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66231/new/

https://reviews.llvm.org/D66231





More information about the llvm-commits mailing list