<div dir="ltr">Hello,<br><br>Appreciate the swift responses.<br><br>I need this feature in GHC 8.10.7. This, I believe is only available post<br>9.10. I can try replicating the same kind of behavior in GHC 8.10.7.<br><br>Some more context to the problem at hand:<br><br>The overhead of the profiling I want to enable should be as minimal as possible<br>as we plan to run this build in production.<br>The memory leak I'm trying to debug happens over a few days after over a million<br>requests and we aren't able to replicate it offline.<br><br>I can take inspiration from the work done in 9.10 and replicate it in 8.10.7 in<br>a way that it can be used without other features of profiling.<br><br>This is what I was trying to do. Ie. Add a new field "era" in the "StgHeader"<br>instead of "StgProfHeader". Making the follow-up changes was the problem as I<br>might've missed the bookkeeping in a few places. But now I can look at 9.10. So<br>I have a baseline to compare with.<br><br>I will try this, and get back to this thread.<br><br>Best,<br>Adithya</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Feb 25, 2024 at 9:33 PM Rodrigo Mesquita <<a href="mailto:rodrigo.m.mesquita@gmail.com">rodrigo.m.mesquita@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>Hello Adithya,<div><br></div><div>This sounds just like what has been implemented as the default mode for eras profiling: <a href="https://well-typed.com/blog/2024/01/ghc-eras-profiling" target="_blank">https://well-typed.com/blog/2024/01/ghc-eras-profiling</a> — which tracks an “era” for each heap object — and, by default, uses a major garbage collection as the increment trigger.</div><div>Could you check it out and see if it would supersede what you are trying to do?</div><div><br></div><div>Cheers,</div><div>Rodrigo</div><div><div><br><blockquote type="cite"><div>On 25 Feb 2024, at 12:58, Adithya Kumar <<a href="mailto:adi.obilisetty@gmail.com" target="_blank">adi.obilisetty@gmail.com</a>> wrote:</div><br><div><div dir="ltr"><div>Hello,<br></div><div><br></div><div>I want to add a field for collecting information about the number of GCs a</div>particular heap object survived.<br><br>I've done the following to implement this:<br>- Add a field "StgWord gc_id" to struct "StgHeader" and "StgThunkHeader"<br>- Update "SET_HDR" macro in "ClosureMacros.h" to update the "gc_id"<br>- Update the "closureTypeHeaderSize" function in "Heap/ClosureTypes.hs" to<br>  account for that 1 extra word.<br><br>Compilation leads to a segmentation fault. The stage 2 compiler is built. But<br>usage of it leads to a segmentation fault.<br><br>Build output:<br>```<br>chmod +x                                                     inplace/bin/ghc-stage2<br>"inplace/bin/ghc-stage2" -hisuf dyn_hi -osuf  dyn_o -hcsuf dyn_hc -fPIC -dynamic  -O0 -H64m -Wall      -hide-all-packages -package-env - -i -iutils/check-api-annotations/. -iutils/check-api-annotations/dist-install/build -Iutils/check-api-annotations/dist-install/build -iutils/check-api-annotations/dist-install/build/check-api-annotations/autogen -Iutils/check-api-annotations/dist-install/build/check-api-annotations/autogen     -optP-include -optPutils/check-api-annotations/dist-install/build/check-api-annotations/autogen/cabal_macros.h -package-id Cabal-3.2.1.0 -package-id base-4.14.3.0 -package-id containers-0.6.5.1 -package-id directory-1.3.6.0 -package-id ghc-8.10.7.20240224 -Wall -XHaskell2010  -no-user-package-db -rtsopts       -Wnoncanonical-monad-instances  -outputdir utils/check-api-annotations/dist-install/build   -c utils/check-api-annotations/./Main.hs -o utils/check-api-annotations/dist-install/build/Main.dyn_o<br>utils/check-api-annotations/<a href="http://ghc.mk:18/" target="_blank">ghc.mk:18</a>: recipe for target 'utils/check-api-annotations/dist-install/build/Main.dyn_o' failed<br>make[1]: *** [utils/check-api-annotations/dist-install/build/Main.dyn_o] Segmentation fault (core dumped)<br>Makefile:123: recipe for target 'all' failed<br>make: *** [all] Error 2<br>```<br><br>Is there any other place I've missed follow-up modifications?<br><br><div>I appreciate any help  provided.</div><div><br></div>Best,<br>Adithya<br></div>
_______________________________________________<br>ghc-devs mailing list<br><a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a><br><a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><br></div></blockquote></div><br></div></div></blockquote></div>