1335 Program

Yep, it’s one of those “here’s a bunch of random bits that don’t warrant their own posts” posts.

And by “bunch,” I mean “two and a third.”

Progress has been slow lately at the day job. Did you know it’s quite possible to run out of memory in a Java program even with 1 GB of heap? Well, that’s what happens when you run the program for moderately non-trivial inputs. The things I’ve done so far to take care of the problem have proven to delay the onset of OutOfMemoryErrors, but they still eventually happen. What’s really fun is how when memory gets low, it feels like you’re spending more time running the garbage collector than you are running the program itself. Looks like I get to figure out if I’m keeping unneeded references around or if three Solution objects (and the transitive closure of stuff they reference) really do take a gig of RAM.

I also find myself wondering if a C or C++ implementation would avoid the slowdowns caused by the Java garbage collector in low-memory situations. Sure, you don’t have the collector running, but then you have to manually malloc and free everything, and there’s a lot of allocating going on, and there’s a lot of data shared between structures. The costs of memory management headaches could quite easily not be worth eliminating GC overhead. Of course, the real solution is to figure out how to get the program to quit using such an ungodly amount of memory in the first place, if that’s indeed possible.

On the Kingdom of Loathing front, I just reached my favorite area so far: The Valley of Rof L’m Fao. All the monsters there are based on annoying Internet things: you have Spam Witches, XXX pr0n, 1335 H4xX0rZ (“he has a long way to go before becoming 1337″), Anime Smilies, etc. As an added bonus, the trick you need to get into the Valley is an awful, awful, awful pun.

Amy: I’ll put up a post with some of the recommendations you asked for later.

3 Responses

  1. The problem did turn out to be that I was keeping a reference to the unwanted objects around on the call stack. The program’s memory profile is much better now, though there’s still room for some improvements.

  2. Ah, silly AIM language. you must have enjoyed that terribly.

    Thank you for putting up a post of recommendations. If you read my journal, you’d know that I passed my permit test today. :) Have yet to drive mom’s car though, too wet *sigh*


  3. I think the best part of the dungeon is the weapon that works really well against all the enemies there. I won’t spoil it for you, but it’s sheer brilliance.

Comments are closed.