<html><head></head><body>Yes, you can use +RTS -hT, which is available even in the non-profiled runtime. This breaks down the heap by closure type. Of course, you don't have visibility into the source of the allocation, but this is often still quite useful. <br><br>— Ben <br><br><div class="gmail_quote">On May 23, 2020 8:58:30 AM EDT, Richard Eisenberg <rae@richarde.dev> wrote:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">Hi devs,<br><br>Is there a way to count the number of times a particular constructor is allocated? I might want to know, say, the total number of cons cells allocated over the course of a program, or (in my actual case) the total number of FunTy cells allocated over the course of a program.<br><br>I can try to do this with an SCC. But it's very clunky:<br>* The constructor may be used in a number of places; each such place would need the SCC.<br>* SCCs can interfere with optimizations. In my use case, this would negate the usefulness of the exercise entirely, as I think some of the structures I wish to observe should never come into being, due to optimizations (e.g. case-of-known-constructor after inlining).<br><br>Surely, the RTS must be able to count the number of times a constructor is used. But is there any way to access such a feature? If others agree that this would sometimes be helpful, perhaps we can build the feature. Now is not the first time I've wanted this.<br><br>Thanks!<br>Richard<hr>ghc-devs mailing list<br>ghc-devs@haskell.org<br><a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><br></pre></blockquote></div><br>-- <br>Sent from my Android device with K-9 Mail. Please excuse my brevity.</body></html>