Comments (5)
So, yep, real issue
Is it wrong that I breathed a sigh of relief?
Thanks for figuring it out. I'll update and retest when there's a patch.
from memray.
Who memory profiles the memory profilers?
Well, to my immense surprise, I can reproduce this. I'll need to spend some time figuring out what is going on. Our working set size shouldn't be nearly this large, so clearly more is being kept alive from one test to the next than we intended.
from memray.
Some initial notes:
- It's not related to flaky; I see the same thing with pytest-repeat, and I'm confident we'd see the same with tests that are just parametrized to run many times
- Memray 1.5.0 is fairly old, but the issue reproduces even with the latest version, so it's not something we've fixed already
- While the process is chugging through memory, I've spotted 65k entries in
/proc/$pid/maps
, which is... a lot. We've got many copies of every shared library loaded in memory, presumably from either the unwinding or symbolifying that we need to do to support native traces...
from memray.
So, yep, real issue. We're leaking the state associated with libbacktrace's unwinding for each test case. We have to leak it - the API of libbacktrace is designed so that's the only option, surprisingly:
memray/src/vendor/libbacktrace/backtrace.h
Lines 81 to 85 in 98032ae
But, we ought to be reusing it from one test case to the next, instead of leaking it between each test and creating a new one for the next test. This has been wrong for a long time, but we never noticed because only pytest-memray
reads many different capture files during the lifetime of the program - it's not possible to trigger this misbehavior through the public Memray APIs or the memray
CLI entry point, because they only ever operate on one single capture file.
It's easy enough to fix - we just need to move some state to be explicitly global rather than recreating it each time a new capture file is read, and wrap a lock around it. While looking at the surrounding code I spotted some other things that I don't like, though, so I'm gonna try to clean up a few different things here...
from memray.
@tonybaloney the latest release, includes a bug fix for this. Hopefully it works this time. 😊
from memray.
Related Issues (20)
- Add support for `memray --version` and maybe `memray -V` HOT 1
- memray is currently broken by Cython 3.0
- Failure to build memray HOT 5
- Publish ARM Linux Wheels HOT 1
- Summary reporter no longer reporting anything with 1.9.0 HOT 3
- memray attach fails HOT 5
- Supporting for sending memray profiled files to pyroscope HOT 4
- Support --follow-fork HOT 1
- Using `memray attach` on a suspended process leads to a segfault
- Core dumped with couchbase==4.1.4 HOT 3
- memray attach command reports error "No module named 'memray'" HOT 2
- Support writes to S3 HOT 2
- --no-web Packaging Option HOT 3
- `memray attach` with lldb can trigger an abort due to stack smashing detection
- MacOS Sonoma: SIGBUS errors HOT 34
- Allow to render flame graphs from large files HOT 1
- The process completes without the file output progress bar reaching 100%. HOT 3
- Follow Fork Bin File Overwritten When Pool of Workers Reuse PID HOT 5
- Generate the output of "memray tree" in a html format with support to collapse/expand sub trees HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from memray.