New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fnmatch.py can appear in tracemalloc diffs #66151
Comments
When using some filters and comparing snapshots, fnmatch will appear in the statistic diffs, e.g.: /home/antoine/34/lib/python3.4/fnmatch.py:70: size=824 B (+64 B), count=2 (+1), average=412 B Perhaps it would be nice to manually cache the compiled re pattern, instead of going through fnmatch's lru_cache thing which seems to make reports less robust. |
During the design of the tracemalloc module (PEP-454), it was decided to not filter traces in the C module, but filter traces on a snapshot object. The reason is to keep the C module simple. To debug, you can analyze snapshots on a fast machine. Can you try to filter traces? snapshot = snapshot.filter_traces(Filter(False, tracemalloc.__file__)) In you case, the top frame is in the fnmatch module, so you probably need to trace more than one thread (ex: tracemalloc.start(10)) and apply the filter on all frames, not only on the top frame: snapshot = snapshot.filter_traces(Filter(False, tracemalloc.__file__, all_frames=True)) You can also ignore fnmatch & sre_compile modules (blacklist, exclusive filters), or only keep traces of the directory /home/antoine/llvmpy/llvm/ (whitelist, an inclusive filter).
Ah, interesting point. Would you be interested to work on that? I tried to use tracemalloc to detect memory leaks in test.regrtest, but it's very difficult to get a reliable output. See the issue bpo-19816. |
In 3.5+ lru_cache() is implemented in C. Is this issue still actual? |
Exposing internal caches in tracemalloc is not a bug but a deliberate choice. It's easy to write your own filters to ignore selected files (or even specific functions if you can locate them by line nubmers). |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: