KBD

Keith Devens .com

Friday, August 29, 2008 Flag waving
whether or not it is clear to you, no doubt the universe is unfolding as it should.... – Max Ehrmann (Desiderata)
← Domino Effects in Static TypingVisualWorks: Joy of Smalltalk →

Daily link icon Sunday, October 2, 2005

Is Java's memory management really *this* asinine?

I noticed while reading this article on Java's garbage collection this note:

NOTE: The im object is set to null because there is no gurantee the stack slot occupied by it will be cleared when it goes out of scope. A later method invocation whose stack frame contains the slot previously occupied by im might not put a new value there, in which case, the garbage collector still considers the slot to contain a root... As a precaution, you can increase the probability that an object will become softly, weakly, finalizable, or phantomly reachable by clearing variables that refer to it.

So Java doesn't even guarantee when the scope of a method is exited that local variables are actually available to garbage collect? This seems really broken to me. That article is from 1998 -- does Java still work this way?

Update: I asked our Java expert at work and he said that, for one, Sun's VM never worked this way, but some other vendors' did for efficiency (essentially they'd just move the stack pointer without telling the garbage collector about it); that's the only reason the article mentioned it. He also said other vendors' VMs don't work this way anymore, so this should no longer be an issue in Java at all.

← Domino Effects in Static TypingVisualWorks: Joy of Smalltalk →

Comments XML gif


Feel free to post a comment below. Please see my comment policy.

Formatting Rules (No HTML):

  • **bold**, *italic*, _underlined_, --strikeout--
  • "text"="url" creates a link, and URLs are auto-highlighted
  • Blockquote: Like e-mail, begin paragraph with > (greater-than sign)
  • Lists: begin paragraph with *,-, or + (unordered), or # (ordered)
  • Code block: ?!code:language=perl|php|sql|javascript|etc.{\n}...{\n}?!/code

:
(will be your IP address if blank)
: (optional)
(Will not be shown on site)

: (optional)
:

August 2008
SunMonTueWedThuFriSat
 12
3456789
10111213141516
17181920212223
24252627282930
31 



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 3 posts

Recent comments XML

new⇒WoW Forums -> Tanking in Wrath of the Lich King

 cheap wow gold in www.wow4s.com or​www.agamegold.com.and cheap​powerleveli...

74.53.254.179: Aug 29, 11:19pm

new⇒Johnny Walker Blue Label

Wow, thanks for the scotch review​:D

Lagavulin and Laphroaig are​some of...

Keith: Aug 29, 3:35pm

Girls, please don't get breast implants

Wow, After all this time, the​comments on this page continue to​grow. It wa...

Ajeet: Aug 25, 2:36am

Generated in about 0.124s.

(Used 8 db queries)

mobile phone