[PATCH] D126723: [pseudo] GC GSS nodes, reuse them with a freelist

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 8 14:43:59 PDT 2022


sammccall added inline comments.


================
Comment at: clang-tools-extra/pseudo/lib/GLR.cpp:78
+    // We need to copy the list: Roots is consumed by the GC.
+    Roots = NewHeads;
+    GSS.gc(std::move(Roots));
----------------
hokein wrote:
> nit: I'd rather pass the NewHeads as a vector parameter, and get rid of the `Roots` variable in the lambda, but up to you.
That would result in reallocating the array every time: we would allocate a new vector to copy  NewHeads into, copy it, gc() would own it and destroy (deallocate) it at the end.

As the code is now, Roots stays alive. Each time we GC we fill it up with elements, and then gc() clears them out again, but we never actually deallocate the buffer.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126723



More information about the cfe-commits mailing list