Skip to main content

[JAVA2D] memory management

3 replies [Last post]
Anonymous

Hi all-

Any help witht he following sigue would be much appreciated:

I am writing program in Java2D (and some JAI) to manipulate jpeg images.
The images are first opened as Tiffs in a thumbnail and then transferred
into a database through a JPEGEncoder byteinputstream. They are then
taken out of the database and displayed in my Java2D viewerPane. The
jpegs are of size 150k aprox. And the tiffs of 4 mbs. Whenever I try to
do the transformation of the original tiff image to jpeg input stream,
my program gives me an out of memory error (Java Heap space). I have
tried several things but I cannot seem to resolve this problem. Also
when I open several viewers witht eh jpeg images, I get the same
message. If anyone can give me some insight or interesting links to
good memory management, that would be great. I just don't understand
because I didn't think the images I am using would take up so much space
that the program crashes so easily. Surely there are bigger more
complicated programs with larger image files that do no have the same
problem I do. Thanks for any help.

David

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
[att1.html]

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
David Kavanagh

Here is the link to that Sun tool I was referring to.
http://developers.sun.com/dev/coolstuff/jvmstat/
good stuff!

Quoting "Braun-Friedman, David" :

> Hi all-
>
> Any help witht he following sigue would be much appreciated:
>
> I am writing program in Java2D (and some JAI) to manipulate jpeg images.
> The images are first opened as Tiffs in a thumbnail and then transferred
> into a database through a JPEGEncoder byteinputstream. They are then
> taken out of the database and displayed in my Java2D viewerPane. The
> jpegs are of size 150k aprox. And the tiffs of 4 mbs. Whenever I try to
> do the transformation of the original tiff image to jpeg input stream,
> my program gives me an out of memory error (Java Heap space). I have
> tried several things but I cannot seem to resolve this problem. Also
> when I open several viewers witht eh jpeg images, I get the same
> message. If anyone can give me some insight or interesting links to
> good memory management, that would be great. I just don't understand
> because I didn't think the images I am using would take up so much space
> that the program crashes so easily. Surely there are bigger more
> complicated programs with larger image files that do no have the same
> problem I do. Thanks for any help.
>
>
> David
>
> ===========================================================================
> To unsubscribe, send email to listserv@java.sun.com and include in the body
> of the message "signoff JAVA2D-INTEREST". For general help, send email to
> listserv@java.sun.com and include in the body of the message "help".
>

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Dmitri Trembovetski

FYI, some of these tools are now shipping with jdk1.5. Check out:
jconsole, jstat, jinfo, for example.

Thank you,
Dmitri

On Thu, Oct 14, 2004 at 08:14:45AM -0400, David Kavanagh wrote:
> Here is the link to that Sun tool I was referring to.
> http://developers.sun.com/dev/coolstuff/jvmstat/
> good stuff!
>
> Quoting "Braun-Friedman, David" :
>
> > Hi all-
> >
> > Any help witht he following sigue would be much appreciated:
> >
> > I am writing program in Java2D (and some JAI) to manipulate jpeg images.
> > The images are first opened as Tiffs in a thumbnail and then transferred
> > into a database through a JPEGEncoder byteinputstream. They are then
> > taken out of the database and displayed in my Java2D viewerPane. The
> > jpegs are of size 150k aprox. And the tiffs of 4 mbs. Whenever I try to
> > do the transformation of the original tiff image to jpeg input stream,
> > my program gives me an out of memory error (Java Heap space). I have
> > tried several things but I cannot seem to resolve this problem. Also
> > when I open several viewers witht eh jpeg images, I get the same
> > message. If anyone can give me some insight or interesting links to
> > good memory management, that would be great. I just don't understand
> > because I didn't think the images I am using would take up so much space
> > that the program crashes so easily. Surely there are bigger more
> > complicated programs with larger image files that do no have the same
> > problem I do. Thanks for any help.
> >
> >
> > David
> >
> > ===========================================================================
> > To unsubscribe, send email to listserv@java.sun.com and include in the body
> > of the message "signoff JAVA2D-INTEREST". For general help, send email to
> > listserv@java.sun.com and include in the body of the message "help".
> >
>
> ===========================================================================
> To unsubscribe, send email to listserv@java.sun.com and include in the body
> of the message "signoff JAVA2D-INTEREST". For general help, send email to
> listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

David Kavanagh

The default max heap is 64MB, so the first thing I'd try is simply raising that.
By supplying -Xmx128m, on the commandline when you launch your program, you'll
double the limit. There are tools to watch the heap and I recommend that
everyone who is doing a lot with memory make use of them. Things like JProbe
and OptimizeIt are profiling tools, but something free and simple like the heap
monitor from Sun (cool tools)... I'm trying to find the URL... Anyway, it can
help give you a picture of what is happening with the various heap spaces (yes,
there are more than 1). Well, I'm having problems finding it. Perhaps someone
from Sun can chime in.

Best of luck,
David

Quoting "Braun-Friedman, David" :

> Hi all-
>
> Any help witht he following sigue would be much appreciated:
>
> I am writing program in Java2D (and some JAI) to manipulate jpeg images.
> The images are first opened as Tiffs in a thumbnail and then transferred
> into a database through a JPEGEncoder byteinputstream. They are then
> taken out of the database and displayed in my Java2D viewerPane. The
> jpegs are of size 150k aprox. And the tiffs of 4 mbs. Whenever I try to
> do the transformation of the original tiff image to jpeg input stream,
> my program gives me an out of memory error (Java Heap space). I have
> tried several things but I cannot seem to resolve this problem. Also
> when I open several viewers witht eh jpeg images, I get the same
> message. If anyone can give me some insight or interesting links to
> good memory management, that would be great. I just don't understand
> because I didn't think the images I am using would take up so much space
> that the program crashes so easily. Surely there are bigger more
> complicated programs with larger image files that do no have the same
> problem I do. Thanks for any help.
>
>
> David
>
> ===========================================================================
> To unsubscribe, send email to listserv@java.sun.com and include in the body
> of the message "signoff JAVA2D-INTEREST". For general help, send email to
> listserv@java.sun.com and include in the body of the message "help".
>

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".