Using the Snowbound Finalize Method to clear up memory in Java™

Java garbage collection will only clear up memory allocated to an object when it determines there is no reference out there for that object. The RasterMaster for Java imaging SDK includes a finalize method that sets all the internal data arrays to null as well as the scroll bar components so the GC can remove it.

Although it isn't mandatory, it is best practice to call the finalize method when an object is no longer needed. However, calling the finalize method does not automatically call the Java GC. If the GC does not run before you decompress another image, then the old data is still in memory along with the new data, and you will have less memory to work with. You should call the finalize method before each decompress and also the Java GC (...




...) to make sure you free up the memory previously used by the Snowbound object.

It is perfectly fine to re-use the snowbound object over and over again. You do not need to call the finalize method unless you are done using the object. The finalize needs to be called since the scroll bars are not properly removed internally in Java when the object is deleted.