Github user vanzin commented on the pull request:

    https://github.com/apache/spark/pull/1387#issuecomment-49065130
  
    I'm not sure I understood your last comment, but anyway: these object had 
references to them at some point. What you're suggesting is that, at some 
point, those references stopped existing, but there's still clean up that needs 
to be done. And if you're doing that clean up by using the gc, it means the 
cleanup is happening in a finalizer, which is bad.
    
    That means there is a bug in the code that is getting rid of those 
references: it should be doing this cleanup.
    
    This is no different than having to call `close()` on an InputStream. Yes, 
you can not do it and leave it for the GC to invoke finalizers, but that's 
wrong. Your code should explicitly close the streams.
    
    Unless I'm misunderstanding what you're trying to achieve. But regardless 
of what that is, `System.gc()` is *not* the answer.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to