Pages Navigation Menu

Coding is much easier than you think

Does garbage collection guarantee that a program will not run out of memory?

 
Garbage collection does not guarantee that a program will not run out of memory. It is perfectly possible for a programmer to mistakenly create objects which never go out of scope, thus consuming more and more memory until all heap is exhausted.

It is the programmer’s responsibility to ensure that objects no longer in use are no longer referenced by the application. That way the garbage collector can do its job and reclaim memory used by these objects.

Automatic garbage collection only means that garbage (i.e., unreferenced memory) is automatically collected (i.e., reclaimed for further use). If you keep references to it, it’s not garbage, and not collected.

About Jamil


Am currently working as a Struts 2, Webservices Developer in a reputed IT Organisations. I can help you with teaching Core java , Struts 2, Webservices and Site Design.

    Struts 2 + Log4j integration example
    log4j.properties example
    SimpleCodeStuffs located at 511/67 Huynh Van Banh , Ho Chi Minh, VN . Reviewed by 56 customers rated: 4 / 5