Comments (7)
Interesting links to the CPython tests and the test_refcount test in particular which had to use a global instead of a local when testing refcounts.. Global objects don't get more references by PyFrame_FastToLocals.
Maybe a workaround would be to use global objects in Heapy tests and for the GC Hook object but I am not sure if it would have bad consequences or how many changes would be needed. What about multiple Heapy objects...
Another way if not using global objects could be to have the variables as object member variables, I suppose those would also not get more references. Have to think more about of this and test.
I think the check in View.py could be fixed by making the GC Hook handle a member variable.
But it remains to fix the tests, probably by encapsulating the critical variables in objects or making they global (urk). I checked in the new version in the link below. Travis test passes so far.
Note that this is my local version Guppy-PE for Python2, I haven't forked the Guppy3 (yet) so I can't commit to that directly.
PS: I am not going to fix the tests, not for now anyway, because it is late in the evening and tomorrow I will go to the work again.
from guppy3.
Hmm... I want to see if there is a way to clear this reference chain, even if we must use C code.
from guppy3.
I just saw https://bugs.python.org/issue30744...
from guppy3.
The ugly side of this is that, I can't just simply clear these locals dicts. PyFrame_LocalsToFast
is called with clear set so clearing the dict would effectively clear all locals.
Now I wish PEP 558 get some real progress.
from guppy3.
Yeah, I'm afraid unless that PEP gets done, assigning to a temporary container is the only way to avoid this extra reference. How about, make Guppy work under a tracer, but don't expect the tests to pass? I mean, people are unlikely going to hit this unless they pdb against guppy test suite.
Btw, why make _local_clear_hook_handle
a attribute of the glue instead of a container as a local variable? The extra reference from the call_trampoline is only going to affect objects directly referenced by a frame as a local variable.
from guppy3.
Yes, a local container seems to be a much easier and better way to do it!
And yes, it sounds at least somewhat reasonable to not require the tests to pass when tracing is enabled, unless you need that to find out the reachable code.
from guppy3.
unless you need that to find out the reachable code.
One could use a tracer written in C to trace this. I was just messing with Python tracers ;)
I think for someone who isn't trying to mess with stuffs, pdb is probably the most likely Python tracer being used, especially that most popular and less complex tracers have a variant written in C, like cProfile vs profile.
from guppy3.
Related Issues (20)
- Feature: replace/patch an imported class at runtime HOT 15
- Question: How to analyze guppy heap files HOT 2
- Getting text output from tool HOT 3
- Idea: Save the entire reference graph (to make profile browsers more useful)
- Feature: monitor external python process, possibly by injecting a stub? HOT 3
- pywin32<300 causes NULL pointer deference during referrer graph generation HOT 32
- Provide `guppy.__version__` HOT 1
- Use commas for big numbers HOT 5
- Add support to release aarch64 wheels HOT 2
- [Question] How does `theone` return the Python object? HOT 8
- python.exe crashed on hpy.heap() after Import Official Dropbox SDK for Python HOT 2
- Is it possible to dump the memory snapshot for offline analysis? HOT 3
- Usage with JAX HOT 8
- TypeError: '<' not supported between instances of 'weakref' and 'weakref' HOT 4
- Heisenbug: test_RefPat.RefPatCase.test_presentation fails sometimes on Python 3.9 on Windows HOT 4
- AttributeError with guppy.heapy.UniSet.IdentitySetMulti.partition HOT 3
- Fails to build on Python 3.11 RC2: fatal error: longintrepr.h: No such file or directory HOT 13
- Profile Browser fails with AttributeError: 'bool' object has no attribute '_root' HOT 4
- Remote monitor mode not available for python >3.8 ? HOT 1
- Exception in creating hpy instance
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 guppy3.