Forums Register Login

Garbage Collection

+Pie Number of slices to send: Send


Hi Guys & Gals,
My manager the other day said to me that Java as a language
is more suited for small to mid size applications when taking
into concern Javas approach towards garbage collection.
He noted that Java basically holds a heap of objects used and
when that heap has reached its max size the thread starts to
inspect each individual object w/i the heap to see if it
should be discarded. Being this, he says that due to the time
it would take to scan through larger sized heaps, itsbetter
for smaller or mid-sized apps.

I knew I couldnt reply by askin him to forcefully start the
garbage collection thread n times, since this is unreliable.
So, what are some other alternatives. Ive heard mumblings of
"finalize", and others have mentioned something called
"weak reference". Could someone possibly help me here. I have
done a good amount of research and Id like to be able to
reply him constructively ya know?

Thanks
+Pie Number of slices to send: Send
 


He noted that Java basically holds a heap of objects used and
when that heap has reached its max size the thread starts to
inspect each individual object w/i the heap to see if it
should be discarded. Being this, he says that due to the time
it would take to scan through larger sized heaps, itsbetter
for smaller or mid-sized apps.


One question, how does the interpreter know what size to set the heap? If a larger app has a bigger heap, how does this happen without explicitly setting this value on the interpreter command line?
Additionally, the garbage collector is supposedly a low priority thread, thus if other threads need something they will supercede the gc thread. Therefore the contention that my program will slow down whilst waiting for the GC to search thru the heap, seems a little silly.
I don't claim to fully understand Garbage Collection as I have seen very inconsistent results. I do know that coding style can have a profound effect on GC.
Ask your manager a simple question. Would they prefer a large program with memory leaks (because someone forgot to clean up) or a large program with automatic garbage collection? Garbage collection will eventually occur, memory leaks require outside assistance to reclaim that memory. Java is slow due to its interpreted nature, not because of GC.
catch it before it slithers away! Oh wait, it's a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 819 times.
Similar Threads
Simple but advanced question
static variable memory
improving tomcat performance
Neophyte app performance question
Garbage Collection suggestions
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 14:53:44.