I collected a list of profilers (also memory profilers, also specifically for Python) here: https://github.com/albertz/wiki/blob/master/profiling.md Currently I actually need a Python memory profiler, because I want to figure out whether there is some memory leak in my application (PyTorch based training script), and where exactly (in this case, it's not a problem of GPU memory, but CPU memory). I tried Scalene ( htt…
Memray – A Memory Profiler for Python
21–30 of 33 posts
Re: Memray – A Memory Profiler for Python
#22For those Python programmers out there, if you don't mind sharing your experiences, do you spend any time at all on the REPL? If so, what fraction of the time, approximately? Using IPython, JupyterLab, or something else? Or do you just run it directly from an VS Code or PyCharm? Anything you may want to add about your routine would be appreciated. Oh, if you (experienced programmer or not) happen to know about a good…
Re: Memray – A Memory Profiler for Python
#23I collected a list of profilers (also memory profilers, also specifically for Python) here: https://github.com/albertz/wiki/blob/master/profiling.md Currently I actually need a Python memory profiler, because I want to figure out whether there is some memory leak in my application (PyTorch based training script), and where exactly (in this case, it's not a problem of GPU memory, but CPU memory). I tried Scalene ( htt…
Re: Memray – A Memory Profiler for Python
#24Re: Memray – A Memory Profiler for Python
#25Interesting testimonials section. Two out of five are "this looks interesting" and "this might be useful." Another two seem unclear on if they've actually used it. The last one does seem to be from an actual user (and is very positive, for what it's worth).
Where do you see the testimonials section?
Re: Memray – A Memory Profiler for Python
#26I have used memory profilers in PHP. In my experience, it is difficult to analyze why application uses lot of RAM just by looking at stack traces. It is better when you have a graph of references: which variable references which memory block. So that you can see, for example, that `cache.users[23].comments[56].attachments[2].binary_data` uses 10 Mb of RAM.
Re: Memray – A Memory Profiler for Python
#27This means that you can turn the standard profiler into a memory profiler by providing a timing function which reports either total memory allocation or a meaningful proxy for allocation. I've had good results in the past using a timing function which returns the number of minor page faults (via resource.getrusage).
[1] https://docs.python.org/3/library/profile.html#profile.Profi...
Re: Memray – A Memory Profiler for Python
#28Memray: Python memory profiler - https://news.ycombinator.com/item?id=38561682 - Dec 2023 (21 comments)
(Reposts are fine after a year or so. This is in the FAQ: https://news.ycombinator.com/newsfaq.html.)
Also related:
Memray - https://news.ycombinator.com/item?id=31102918 - April 2022 (2 comments)
Memray: a memory profiler for Python - https://news.ycombinator.com/item?id=31102089 - April 2022 (48 comments)
Re: Memray – A Memory Profiler for Python
#29I used this tool recently to debug some issues where one of our batch tasks was using more memory than it should and sometimes OOMing in an environment where it shouldn't come close to hitting a memory ceiling. Found the issue almost immediately with the high watermark analysis which provides visibility into the part of the codebase/call stack that allocated every bit of allocated memory that was still live at the hi…
Re: Memray – A Memory Profiler for Python
#30Ive used Memray and it works great locally. But when I deployed my application over long running processes (i.e. in production) because I want to see memory usage over a long period of time, the profiler outputs get really large, like hundreds of gbs. They cause disk outages and also take forever to download and visualize with the flamegraphs. What do people use to understand memory usage of long running workloads in…
With that option the files are much much smaller and much easier to analyse