Linked by Thom Holwerda on Fri 14th Sep 2012 02:30 UTC, submitted by MOS6510
Java "As a typical Java developer I never monitored the memory usage of my application apart from following typical best practices like closing the connections, streams etc. Recently we were struck with few issues in our JBoss servers that I had to dig in to the memory management."
Thread beginning with comment 535004
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE: Memory management
by Brendan on Fri 14th Sep 2012 03:33 UTC in reply to "Memory management"
Brendan
Member since:
2005-11-16

Java does have memory management; however the memory management is done automatically with object creation and garbage collection.

This means that a lot of Java programmers aren't aware of it, and have no idea about things that improve memory management efficiency. Techniques like recycling objects and using stack (to avoid the overhead of allocating and freeing heap) may never enter a Java developers' mind. Basic things (like setting references to null when the object they refer to is no longer needed) may never happen.

If you make it possible for programmers to ignore memory management, then you shouldn't be surprised if these programmers don't do efficient memory management.

- Brendan

Reply Parent Score: 6

RE[2]: Memory management
by moondevil on Fri 14th Sep 2012 06:50 in reply to "RE: Memory management"
moondevil Member since:
2005-07-08

Techniques like recycling objects and using stack (to avoid the overhead of allocating and freeing heap) may never enter a Java developers' mind. Basic things (like setting references to null when the object they refer to is no longer needed) may never happen.


Don't do this!

These techniques used to be good up to Java 1.4 JVMs, but nowadays they do more harm than good to more modern GCs.

Reply Parent Score: 3

RE[3]: Memory management
by Brendan on Fri 14th Sep 2012 17:36 in reply to "RE[2]: Memory management"
Brendan Member since:
2005-11-16

"Techniques like recycling objects and using stack (to avoid the overhead of allocating and freeing heap) may never enter a Java developers' mind. Basic things (like setting references to null when the object they refer to is no longer needed) may never happen.


Don't do this!

These techniques used to be good up to Java 1.4 JVMs, but nowadays they do more harm than good to more modern GCs.
"

Would you mind elaborating? I can't see how these things can cause more harm than good (regardless of language or VM).

- Brendan

Reply Parent Score: 2