On Tuesday, May 2, 2017 at 8:54:46 PM UTC+1, larry....@gmail.com wrote: > I have a script that consumes more and more memory as it runs. It has > no globals and the large data structures go out of scope often so > should be garbage collected. I've looked at the most likely suspects > with sys.getsizeof and they are not growing in size. I did this: > > sum([sys.getsizeof(o) for o in gc.get_objects()]) > > And I can see it getting larger and larger. But I want to see what it > is that is causing this. My thought was to put all the objects in a > dict with their sizes and compare them as the program runs and report > on the one that are growing. But I can't get the name of the object > from gc.get_objects only the id. > > Anyone have any thoughts on how I can monitor the variables' memory > usage as the script runs?
Haven't tried them but how about https://pypi.python.org/pypi/memory_profiler or https://pythonhosted.org/Pympler/muppy.html. Kindest regards. Mark Lawrence. -- https://mail.python.org/mailman/listinfo/python-list