由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - Question: OutOfMemoryError when drawImag
相关主题
Re: getImage&drawImage的问题替朋友请教一个问题
Java drawImage help please. Urgent!谁能把这个给读出来?(update 怎么从excel里面读image)
Wrap up -Re: Question: OutOfMemoryError紧急求助: java OutOfMemoryError
Re: Question: OutOfMemoryError when drawjava.lang.OutOfMemoryError: Java heap space in DB query
OutofMemoryError: Java Heap SpacegetImage有个问题
help: where to download JAVA/swing? (转载)Where I can find comparison of JVMs
这里有做J2ME的吗?how to update swing components
Fatal Error怎么回事?@goodbug: Wicket vs JSF
相关话题的讨论汇总
话题: image话题: drawimag话题: question话题: when
进入Java版参与讨论
1 (共1页)
g**********y
发帖数: 14569
1
In my application, I draw a sequence of JPEG images on a component:
(1) Read image file from hard-disk, use MediaTracker to guarantee it's fully
loaded before drawing
(2) Pass the Image object to component, and in paint() method, draw the Image
Program runs fine until around 200 times loop, OutOfMemoryError pops up.
I searched FAQ and newgroups, find people suggesting calling Image.flush()
after drawing. I add this after drawImage() call, still, it doesn't help.
Anyone has suggestions?
Thanks!
xt
发帖数: 17532
2

When you run java, add sth like "-mx512m" to define the maximum
memory for JVM. You can define up to 2048m.

【在 g**********y 的大作中提到】
: In my application, I draw a sequence of JPEG images on a component:
: (1) Read image file from hard-disk, use MediaTracker to guarantee it's fully
: loaded before drawing
: (2) Pass the Image object to component, and in paint() method, draw the Image
: Program runs fine until around 200 times loop, OutOfMemoryError pops up.
: I searched FAQ and newgroups, find people suggesting calling Image.flush()
: after drawing. I add this after drawImage() call, still, it doesn't help.
: Anyone has suggestions?
: Thanks!

g**********y
发帖数: 14569
3
That can only relieve the symptom instead of solving the problem. I set it to
512M, it just runs out of memory in longer time.
Why JVM holds the graphics memory so long? Is it a design bug or just because
I didn't find the right way to force the releasing of memory?
KG
发帖数: 515
4
do you load the image everytime paint() is called? Does it have to be an AWT
app?

【在 g**********y 的大作中提到】
: In my application, I draw a sequence of JPEG images on a component:
: (1) Read image file from hard-disk, use MediaTracker to guarantee it's fully
: loaded before drawing
: (2) Pass the Image object to component, and in paint() method, draw the Image
: Program runs fine until around 200 times loop, OutOfMemoryError pops up.
: I searched FAQ and newgroups, find people suggesting calling Image.flush()
: after drawing. I add this after drawImage() call, still, it doesn't help.
: Anyone has suggestions?
: Thanks!

1 (共1页)
进入Java版参与讨论
相关主题
@goodbug: Wicket vs JSFOutofMemoryError: Java Heap Space
第十章 编程实例help: where to download JAVA/swing? (转载)
Top Ten Errors Java Programmers Make(9)这里有做J2ME的吗?
Re: FileDialog 的问题Fatal Error怎么回事?
Re: getImage&drawImage的问题替朋友请教一个问题
Java drawImage help please. Urgent!谁能把这个给读出来?(update 怎么从excel里面读image)
Wrap up -Re: Question: OutOfMemoryError紧急求助: java OutOfMemoryError
Re: Question: OutOfMemoryError when drawjava.lang.OutOfMemoryError: Java heap space in DB query
相关话题的讨论汇总
话题: image话题: drawimag话题: question话题: when