Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2005

Tip: Looking for answers? Try searching our database.

Question about memory use in JAI

Thread view: 
syg6 - 17 Nov 2005 14:54 GMT
Hello all.

I have a general question about memory usage in JAI. When I issue a
JAI.create() command, like the following:

PlanarImage image = (PlanarImage) JAI.create("fileload", path);

I notice that the javaw.exe process jumps up to something like 50 Mb.
(The image weighs about 3Mb). I have tried everything I know to free up
memory after having processed the image, and nothing seems to work. I
have tried:

cache.flush()
image.dispose()
JAI.disableDefaultTileCache();
image.removeSinks()

No matter what I do the memory doesn't drop. I have read that the JAI
cache frees up space automatically (by deleting images) when more space
is needed. But from what I have seen the cache is not the problem; I do
a cache.flush() and it is emptied out but the memory used by the JVM
remains the same.

Any ideas on what could be happening here?

Thanks in advance,
syg
Andrew Thompson - 17 Nov 2005 15:03 GMT
> ...But from what I have seen the cache is not the problem; I do
> a cache.flush() and it is emptied out but the memory used by the JVM
> remains the same.
>
> Any ideas on what could be happening here?

It might be you are getting over anxious.  Have there been
any OutOfMemoryErrors in this application?  It might just be
the 'JVM remains the same' simply because it sees no reason
to perform Garbage Collection.
syg6 - 17 Nov 2005 15:45 GMT
True enough, I am a pretty anxious guy. :)

But from what I've read the JVM assigns 16Mb of memory to JAI, and when
I create the image the JVM memory jumps to 50! The second image makes
it jump to 100, etc. So far with 4 images, all of which are more or
less the same size, it jumps up to 170Mb. Well beyond 16Mb. And when I
try to force garbage collection by calling dispose() and setting the
image to null, AND calling garbage collection by hand, and nothing
happens.

Even if I am being anxious, shouldn't some kind of garbage collection
be going on here?

Confused ...
syg
Roedy Green - 17 Nov 2005 15:57 GMT
>Even if I am being anxious, shouldn't some kind of garbage collection
>be going on here?

Like an energy-conserving (lazy) husband, by default, Java does not
handle the garbage until it has to.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Roedy Green - 17 Nov 2005 15:56 GMT
>No matter what I do the memory doesn't drop.

This is normal. It won't drop until the next garbage collection.

See http://mindprod.com/jgloss/garbagecollection.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.