Dump the GC

March 27, 2008 on 10:39 am | In Personal, Programming | By QBasicer | 4 Comments

Ironically, what some say that the Java Garbage Collector is one of the best features of the language. For some people, yes, but as a C/C++ programmer, I’m more accustomed to managing my own memory. In fact, I think it’s almost insulting to have to rely on the virtual machine’s ability to guess when I’m done with an object. I’d personally really like to see the ability to switch the gc into manual mode, where there is no automatic collection of garbage, and you must specifically call a delete command.

And don’t give me any nonsense on nulling objects. Really. I currently am using a library that when I null the only pointer to it, it persists in memory. There’s nothing I can do about the 700 megs of memory it takes up while loaded. I can see that in an attempt to be smart, it’s stupid. Save me the clock cycles, and just let me do it myself. Please.

4 Comments »

RSS feed for comments on this post. TrackBack URI

  1. Woah, woah! You mean Java will automatically delete your data if it thinks you are done with it? Good Lord Java sucks even more than I already thought!

    I’ll decide when I want to delete something, thanks.

    Comment by BioHazard — March 28, 2008 #

  2. Yes, after a certain amount of time, it checks to see if an object is accessible by anyone, so that if nobody can ever access the object again, it removes it. By just keeping a pointer, you prevent the address from being freed.

    Comment by QBasicer — March 29, 2008 #

  3. So when you free() something, it doesn’t actually get free()d until x seconds pass?

    Comment by BioHazard — March 31, 2008 #

  4. There actually is no “free()”, when the Java VM detects that nobody can get it, then it collects it, but other than that, you can’t get it. Say you say:
    InputStream is = new InputStream();
    //Object now exists
    is = new InputStream();
    //The old object now gets deleted
    is = null;
    //The second object gets deleted

    Comment by QBasicer — March 31, 2008 #

Leave a comment

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Powered by WordPress with Pool theme design by Borja Fernandez. I rewrote the CSS because I'm cool like that.
Entries and comments feeds. Valid XHTML and CSS. ^Top^