Posted by chaose71
on April 15, 2008 at 5:22 AM PDT
I am just wondering about something I stumbled over during programming. I implemented a slice plane rendering for a voxel cube, meaning I needed to create 2d images "on the fly". My first approach was to use a BufferedImage (only one) which I filled pixel by pixel with setRGB when the slice plane position changed.
To my surprise, it was not so slow as many ppl reported - but had a huge memory leak effect. Whenever I changed the slice plane position quickly (causing many, many, many setRGB() calls but NO new images), the garbage collector got lots of work to do.
The memory-leaking behavior is not relevant for me anymore since I changed the implementation to MemoryImageSource already, but I am still curious if anyone has an idea why setting pixels consumes that much memory.