CDAT / dv3d

1 stars 0 forks source link

10k+ leaked objects from simple test #3

Open chaosphere2112 opened 7 years ago

chaosphere2112 commented 7 years ago

Running the test_meshfill_draw_mesh.py test leaks about 10,900 objects. This is very significant, as it means that rendering multiple large datasets, even properly scoped so no vcs objects are reachable, will quickly exhaust the available system memory. This is also causing issues interfacing with other modules that need objects to be freed before the interpreter shuts down.

This is easy to test for manually:

  1. Take any existing test, and put the entire file, imports and all, into a def runTest(): block.
  2. Change any sys.exit(x) calls into return x.
  3. Add the following to the bottom of the script:
import gc
gc.enable()
gc.set_debug(gc.DEBUG_LEAK)

result = runTest()

gc.collect()

for i,g in enumerate(gc.garbage):
    print "Leak %d: %s @0x%x:\n   %s"%(i, type(g), id(g), str(g)[:70])

import sys
sys.exit(result)

The results of test_meshfill_draw_mesh.py are here: https://gist.github.com/dlonie/2d72d0cfa4a52271bb7a

Migrated from: https://github.com/UV-CDAT/uvcdat/issues/1343