[racket] question: how to profile allocation?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Thu Jan 27 17:09:59 EST 2011

At Wed, 26 Jan 2011 17:20:51 -0500, Danny Yoo wrote:
> I'm a little stuck with a problem in one of my programs: some place is
> generating so much garbage that I'm triggering a garbage collection
> once every few seconds, and that's bad because the program is meant to
> be used interactively.
> I'm having some difficulty pinpointing what I should be looking at.  I
> looked at the Racket profiler, but it appears to concentrate on CPU
> usage and not allocation.  Are there tools in Racket that can help me
> pinpoint allocation hotspots?

I don't have any good tools to suggest at the moment. We've
experimented with some allocation-tracking hooks in the past, but none
of them are currently in place.

For what it's worth, with extremely frequent allocation in my own
program, I'd attack the problem in a very primitive way: by
interrupting the Racket process in gdb to see what it's doing. If all
the time is in allocation, then I'm likely to interrupt the program
during an allocation, and gdb's stack trace would give me some idea of
what kind of allocation is being performed. Again, though, that's very
low level.

Posted on the users mailing list.