On Wednesday, 2 October 2019 at 15:19:43 UTC, John Colvin wrote:
I have a function that allocates a closure somewhere in it (as shown by the result of -profile=gc).

I can't make the function nogc as it calls a lot of other GC using code.

profilegc.log only gives me the line number of the function signature, which doesn't give me any hint as to where in the function the closure is allocated.

Anyone have any nice tricks to help narrow this down.

This hack seems to show the detailed info of @nogc also in normal code.

------------------------------------------------
diff --git a/src/dmd/func.d b/src/dmd/func.d
index 832cd0bf7..e1fad8cdc 100644
--- a/src/dmd/func.d
+++ b/src/dmd/func.d
@@ -1975,7 +1975,7 @@ extern (C++) class FuncDeclaration : Declaration
         else
         {
printGCUsage(loc, "using closure causes GC allocation");
-            return false;
+//            return false;
         }

         FuncDeclarations a;
------------------------------------------------

Reply via email to