Today I wasted two hours locating and fixing a trivial bug:
“Spent hours debugging my code, fixing hacks
but somehow mistook Math.min() for Math.max()”
Today I wasted 5 minutes trying to think of something that rhymes with “Math.max()”
Today I wasted two hours locating and fixing a trivial bug:
“Spent hours debugging my code, fixing hacks
but somehow mistook Math.min() for Math.max()”
Today I wasted 5 minutes trying to think of something that rhymes with “Math.max()”
I finally got rid of that stupid memory leak in the Star Trek game I’m working on. It turns out when I optimized the use of JLabels I forgot about the action listeners, so the reference to the local copy of the game map was never removed from memory.
With a map update every 35 seconds, the client would go out of memory (200 MB) in 15 minutes, in where around 270’000 action listeners where in memory.
Now however the game can run smoothly for days:

Currently I’m working on a major overhaul of the GUI, and the game looks much better now. I’m gonna release the new screenshots when I get the client stable again and re-integrate the map window in a new way (soon)
Still havent been able to localize that damn memory leak in the Trekwar client. At least the server has no leaks
and can run for days only using around 15-20 MB of memory (galaxy with 10’000 sectors):

The client however will crash after about 10 ticks if the galaxy is really big. Have stared at the code for hours, with no result. I’m going to have to start some methodical and very tedious debugging to get this thing fixed ![]()

I downloaded a new Java tool today, called VisualVM which was released (version 1.0) yesterday and is going to ship with the SUN JDK starting with JDK 6 release 7.
This is a tool that allows you to view information about the java programs currently running on your computer (or a remote computer). It does not seem to provide as much information as JConsole or JManage, but it still gives the most essential information. Besides the tool is still pretty new (version 1.0), so I’m sure we will see lots of improvement in the near future.
Monitoring provides basic information about uptime, memory usage, threads and some other stuff:

The application also has a rudimentary profiler which allows you to see which methods are using cpu cycles, and which objects are hogging all the memory,

The program can also do a heap dump, allowing you to see the size and number of instances of each class. You can also inspect each and every object to view it’s variables and references:

The profiling part was pretty simple and would benefit from more work, but overall I’m pretty sure this tool(even though a bit low on features/information in it’s current state) will be a big hit, and a good entry to profiling and application management to many people.
A very nice feature I did not take a screenshot of is a visual timeline view of all the threads and which state they are in, very smooth
The software is also suppose to let you view core dumps, but did not get a chance to test this feature tonight.
The last week I have been finishing up the online registration system for Nidarosilder, a local ferret show here in Trondheim that we are attending in early September.

The system runs on jsp and postgresql and allows user to register, then they receive a password they use to log in. When logged in they enter their name and other info, and can add up to 20 ferrets. Also my friend Anne who organizes the show has a admin page where she can see all users/ferrets, and sorted displays to make it easier to set up the different classes for the show.
Seeing that the ferret system was ready thursday, I got to spend most of this long weekend (Dont have to work monday 12th because of some religion thingy) on my Startrek game.
I debugged the Research system, and had some problems with the object serialization between the server and the client (ObjectOutputStream.writeUnshared() only writes the ROOT object unshared.. I learned that the hard way). I also made the client show a counter that counts to next game turn, a animation that shows while downloading map data, I implemented the Order system, and now it is possible to move a starship.
Below you can see a federation fleet moving to sector 3:7 (the yellow dots show the path)
Thursday 22. I will be going to Austria with the people from work, so maybe then I will have the time to implement the build system when there =)