Memory and Threads
I have a Java3d application for loading and visualizing rather large data sets. I've noticed a quite severe increase in heap memory which is not garbage collected properly.
After each unloading of my data I'm in fact destroying every object connected with Java3d by dereferencing them, even Canvas3D. So I'm able to initialize and reset everything to a certain state when loading another data set.
I used JConsole (and Netbeans profiler) to track down the possible problem for the using up of the heap when I recognized, that after each loading of a new data set, in the moment of initialization of the Canvas3D and the several Branchgroups, a whole new set of Java3d threads came to live. After each unloading and loading and setting up the Canvas3D, nine new Threads were started. All of them remained alive, so after a while I have a lot of threads which aren't in use anymore (apart from the newest ones), but still were kept in memory, perhaps being responsible for the increasing memory footprint. I wasn't able to find out which resources were used or held by these old threads…
Here the list of the threads that are started multiple times: