I was running into a problem (now fixed) in which gc was running constantly, so I put together the following hack to figure out who was doing the allocation. Set gc-quit-frequency to something like 20, and then set debug-on-quit, and you'll get a backtrace every 20th gc. It's hardly precise, but often one just needs a hint to suss out the cause.