How do show_growth deltas behave when memory runs out?
rschwiebert opened this issue · 1 comments
I'm profiling to find a leak in an API endpoint that runs a complex process. I have objgraph.show_growth report at two or three points inside the endpoint's main method.
Hitting the endpoint over and over, I quickly hit a MemoryError, and for a while large positive deltas are reported, but finally the deltas stop being reported at all.
I guess conceivably this could mean one of two things:
- There is no positive delta to report: memory is saturated with objects involved and no new ones are created.
- Objects are being created, but show_growth can't function properly in the given memory, so it doesn't report them.
I don't really understand this library well enough to see which one is more likley, but can you comment as to which one you think it is?
Thanks.
Ooof. I've never dealt with a MemoryError, so I cannot say for sure. I would speculate that a MemoryError might mean some internal data structures get updated incompletely, which might cause the next show_growth() to report more new objects than there are actual new objects (assuming no more MemoryErrors occur).
You can always double-check by looking into how many objects are tracked by the Python garbage collector, by looking at len(gc.get_objects())
periodically.