Java Heap Overflow, Forcing Garbage Collection
        Posted  
        
            by Nicholas
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Nicholas
        
        
        
        Published on 2010-03-12T00:12:28Z
        Indexed on 
            2010/03/12
            0:37 UTC
        
        
        Read the original article
        Hit count: 365
        
I've create a trie tree with an array of children. When deleting a word, I set the children null, which I would assume deletes the node(delete is a relative term). I know that null doesn't delete the child, just sets it to null, which when using a large amount of words it causes to overflow the heap.
Running a top on linux, I can see my memory usage spike to 1gb pretty quickly, but if I force garbage collection after the delete (Runtime.gc()) the memory usage goes to 50mb and never above that. From what I'm told, java by default runs garbage collection before a heap overflow happens, but I can't see to make that happen.
© Stack Overflow or respective owner