Memory leak

A

Anon

I have a strange problem. There is a memory leak in my application
which grows steadily even if no action is being performed on it. AFter
some initial action, when the application is left running with no
action ebing performed, the memory usage by means of the Task
Manager by process java.exe (virtual machine) grows steadily. But if I
minimize Command Prompt window, memory drops down (from 100-120MB)
almost to 10MB. Then it grows again. The memory in the task manager
keeps on increasing even with no action on the application. COuld
anyone give a clue on this?
Rdrs,
Anon
 
T

Tim Ward

Anon said:
I have a strange problem. There is a memory leak in my application
which grows steadily even if no action is being performed on it. AFter
some initial action, when the application is left running with no
action ebing performed, the memory usage by means of the Task
Manager by process java.exe (virtual machine) grows steadily. But if I
minimize Command Prompt window, memory drops down (from 100-120MB)
almost to 10MB. Then it grows again. The memory in the task manager
keeps on increasing even with no action on the application. COuld
anyone give a clue on this?

Your application is quite likely not leaking memory - the problema are
simply that you've chosen to write it in Java, which behaves like this, and
that you're trying to make sense of the memory usage reported by Task
Manager, which is sufficiently difficult that it's best regarded as not
possible. If you can't tolerate this behaviour you will need to rewrite in
another language that gives you better control over memory allocation and
also stop looking at the Task Manager figures.
 
M

Michael Borgwardt

Tim said:
Your application is quite likely not leaking memory - the problema are
simply that you've chosen to write it in Java, which behaves like this,

Depends on the definiton of "inactive". To me, it means that all the
application's threads are blocked or waiting. And in such a state,
heap size should be constant.

So either the JVM does soemthing it shouldn't, or the application is
not, in fact "inactive".
 
T

Tim Ward

Michael Borgwardt said:
Depends on the definiton of "inactive". To me, it means that all the
application's threads are blocked or waiting. And in such a state,
heap size should be constant.

So either the JVM does soemthing it shouldn't, or the application is
not, in fact "inactive".

Sure. We have to assume the application and/or JVM are doing something
boring every now and then which involves some allocation and deallocation
but needn't actually involve a leak.
 
J

John C. Bollinger

Anon said:
I have a strange problem. There is a memory leak in my application
which grows steadily even if no action is being performed on it. AFter
some initial action, when the application is left running with no
action ebing performed, the memory usage by means of the Task
Manager by process java.exe (virtual machine) grows steadily. But if I
minimize Command Prompt window, memory drops down (from 100-120MB)
almost to 10MB. Then it grows again. The memory in the task manager
keeps on increasing even with no action on the application. COuld
anyone give a clue on this?

If you want to dig into the details then obtain one of the various
programs called "heap profilers" and use it to examine your
application's behavior. Java applications do not have memory leaks per
se, but they can be written in such a way that they hold on to objects
that they no longer need, thus consuming more memory than they actually
require and possibly demanding increasing memory without bound. That
does not sound like the problem in this case, however. As Tim Ward
suggested, a JVM might easily exhibit such behavior under normal
operation for any random program. If you want to limit the maximum
memory consumption then your JVM may offer command-line options that
help; for Sun's you would want to look at -Xmx.


John Bollinger
(e-mail address removed)
 
X

xarax

John C. Bollinger said:
If you want to dig into the details then obtain one of the various
programs called "heap profilers" and use it to examine your
application's behavior. Java applications do not have memory leaks per
se, but they can be written in such a way that they hold on to objects
that they no longer need, thus consuming more memory than they actually
require and possibly demanding increasing memory without bound. That
does not sound like the problem in this case, however. As Tim Ward
suggested, a JVM might easily exhibit such behavior under normal
operation for any random program. If you want to limit the maximum
memory consumption then your JVM may offer command-line options that
help; for Sun's you would want to look at -Xmx.

Probably also want to test the application using both
-Xms and -Xmx command line parameters specifying the
same value like: -Xms500m -Xmx500m

That will cause the JVM to not free heap memory back
to the operating system. The application will initialize
with 500MB and it will neither free nor allocate any
heap memory from the OS after initializing. Now then,
if later on the application yields an OutOfMemoryError,
then you probably have memory leak.
 
T

Thomas G. Marshall

Anon coughed up:
I have a strange problem. There is a memory leak in my application
which grows steadily even if no action is being performed on it. AFter
some initial action, when the application is left running with no
action ebing performed, the memory usage by means of the Task
Manager by process java.exe (virtual machine) grows steadily. But if I
minimize Command Prompt window, memory drops down (from 100-120MB)
almost to 10MB. Then it grows again. The memory in the task manager
keeps on increasing even with no action on the application. COuld
anyone give a clue on this?
Rdrs,
Anon


What is the upper bound, or does it keep increasing memory usage until all
VM is sucked dry?

--
Iamamanofconstantsorrow,I'veseentroubleallmydays.Ibidfarewelltoold
Kentucky,TheplacewhereIwasbornandraised.ForsixlongyearsI'vebeenin
trouble,NopleasureshereonearthIfound.ForinthisworldI'mboundtoramble,
Ihavenofriendstohelpmenow....MaybeyourfriendsthinkI'mjustastrangerMyface,
you'llneverseenomore.ButthereisonepromisethatisgivenI'llmeetyouonGod's
goldenshore.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Memory leak 16
memory leak? 0
AJAX memory leak(?) 8
Looping-related Memory Leak 7
memory leak problem. 6
Increasing number of loaded classes. Class leak? 6
Janus GridEX Memory Leak 1
Find memory leak in 1.9 app 5

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top