JediKnight2 wrote On 05/02/07 16:43,:
I have a quick question....I am having an app built and am doing some
test on it to see how it runs, etc. Java looks to eat up LOTS of
memory, but here is what I see. I open the app and then create a
profile...another window pops up to enter the info...of course the
memory goes up some. Well when I close that window out...the memory
never goes down. As a matter of fact if I create yet another
profile...memory usage goes up even higher...is this normal...
Not enough detail to tell "normal" from "abnormal,"
but I'll offer a few thoughts:
First, how are you measuring the memory usage, and
from what vantage point? Few applications -- including
JVM's -- actually release memory once they've obtained
it from the operating system; they're more likely to hang
onto it for possible re-use inside the app. (The fact
that the app needed N megabytes at some point in its
history is taken as evidence that it's likely to need N
again.) So if you're looking at memory usage from the
O/S' perspective, you'll seldom see processes shrink.
Second, have you arranged to dispose() the windows
when you're done with them, or are you just dropping them
on the floor? If you just forget about them after they
close they do not become collectible garbage: Swing has
them sitting there, undisplayed but still instantiated and
ready to be redisplayed at a moment's notice. If you are
accustomed to using DISPOSE_ON_CLOSE or EXIT_ON_CLOSE this
fact may have escaped you, but if you've selected one of
the other window-closing actions and have forgotten to
call dispose() explicitly, you may be piling up heaps and
heaps of unused and semi-forgotten JFrames.
--
Eric.Sos...@sun.com
I am just looking at the memory usage in task manager. Basically the
program connects to a DB on the backend to input data from the form.
as much memory. One thing that drew me to Java was the ability to use