leezu commented on issue #18314:
URL: 
https://github.com/apache/incubator-mxnet/issues/18314#issuecomment-628833322


   That's because I set gc.set_debug(gc.DEBUG_SAVEALL). I want to preserve all 
objects found by gc, because I need to figure out where the reference cycle 
that prevented them from being freed by reference counting, came from.
   
   Howeve, I find that despite gc.set_debug(gc.DEBUG_SAVEALL), the gc will 
still call the finalizer on the objects it finds. That's why we end up with 
zombie objects in gc.garbage:
   ```
   
   Calling finalizer for c_void_p(94420426532208)
   Calling finalizer for c_void_p(94420426532208)
   Calling collect
   Calling finalizer for c_void_p(94420426437968)
   Calling finalizer for c_void_p(94420427373968)
   Calling finalizer for c_void_p(94420428079184)
   Calling finalizer for c_void_p(94420426198000)
   
   ```
   
   We see that after `del net` is called, two ndarrays are finalized thanks to 
reference counting. 4 arrays are only finalized after a full garbage collection.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to