• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.lang.OutOfMemory error

 
tomas gussymurphy
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am using an applet that containn a panel that displays a template image and a slider for generating patterns on the image. there are supposed to be 5 transitions. however when i tr and view it i get a run time error telling me that i am out of memory. the image sizes are all approx 300k each. i have used this program using different more memory intensive images and it works. i am totally confused. any help on this would be greatly appreciated.
tom
 
Marilyn de Queiroz
Sheriff
Posts: 9068
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Frequently OutOfMemoryErrors are caused by creating too many objects. Are you creating Slide and Template objects in a loop, for example?
 
tom MURPHY
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey sorry i didnt get back sooner. i still cant figure it out. i am only creating five image objects. and as isaid already i have had this program working with other images of higher memory. as the images change there is a call to repaint method. ideally i would have to have 20 or more image objects but this is just a prototype. perhaps its to do with heap sizes??? Also each image was originally about 1MB before i exported them down to about 300KB. could this be part of the problem? i am really confused. any help would be very much appreciated.
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A 300K jpeg or gif can be many, many times that size when it's held in memory in uncompressed form. If you have access to a profiler, use that to take a look, otherwise run Java with the profiling flags (-Xhprof and friends).

- Peter
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic