It seems that memray attach is not correctly tracking all new allocated memory.
#869
Replies: 1 comment 7 replies
-
|
Without seeing a reproducer or the Memray report, I'm not sure that there's much I can do to help debug this. One potentially interesting thing to see would be what you get from: memray parse pid.bin | egrep 'HEADER|MEMORY_RECORD' | head
memray parse pid.bin | egrep 'HEADER|MEMORY_RECORD' | tailAt least the "Resident size" line on that plot should be based entirely on those MEMORY_RECORD records. The time stamps on those lines ( that corresponds to $ date -d "@1765223769.603"
Mon Dec 8 14:56:09 EST 2025If you're only getting one memory record, or zero, something is definitely wrong; one should get written about once every 10ms. Likewise something is definitely wrong if you see a memory record with a time before the recorded |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using
memray attachinside a Kubernetes pod on a GPU machine to investigate a memory leak in a production service. My command is:This service is a pure CPU-based service launched via Python's
multiprocessingmodule by a GPU service. Before the container started, the allocator was explicitly set tomalloc. After collecting data for 1800 seconds, the resulting file is only 18.3 MB (compressed). When I generate a temporal flame graph with:the timeline appears incorrect:
The timeline appears to contain only a single valid data point, and the timeline itself is completely scrambled—even including timestamps from the future. Aside from the inaccurate timeline, the memory stack traces seem to be missing all native memory allocations entirely, and even Python allocations appear incomplete.
Even without the
--temporaloption, the statistics reported are clearly wrong—showing only a "Peak memory usage: 7.7 MB," whereas the actual memory usage(RSS) increased by at least 500 MB during that half-hour period.Since this is a company project, I cannot share the original files. However, if you need more information, please let me know, and I can collect additional data. One noteworthy observation: when running
memray attach, it takes about 5–20 seconds before the command returns, whereas on my local macOS machine, it returns almost instantly.Beta Was this translation helpful? Give feedback.
All reactions