Memory leak

Discussion in 'Java' started by Anon, Dec 3, 2004.

  1. Anon

    Anon Guest

    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
     
    Anon, Dec 3, 2004
    #1
    1. Advertising

  2. Anon

    Tim Ward Guest

    "Anon" <> wrote in message
    news:...
    > 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.

    --
    Tim Ward
    Brett Ward Limited - www.brettward.co.uk
     
    Tim Ward, Dec 3, 2004
    #2
    1. Advertising

  3. Tim Ward wrote:
    > 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".
     
    Michael Borgwardt, Dec 3, 2004
    #3
  4. Anon

    Tim Ward Guest

    "Michael Borgwardt" <> wrote in message
    news:...
    > Tim Ward wrote:
    > > 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".


    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.

    --
    Tim Ward
    Brett Ward Limited - www.brettward.co.uk
     
    Tim Ward, Dec 3, 2004
    #4
  5. Anon wrote:

    > 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
     
    John C. Bollinger, Dec 3, 2004
    #5
  6. Anon

    xarax Guest

    "John C. Bollinger" <> wrote in message
    news:copri5$oqe$...
    > Anon wrote:
    >
    > > 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.


    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.
     
    xarax, Dec 3, 2004
    #6
  7. 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.
     
    Thomas G. Marshall, Dec 3, 2004
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Y3liZXJzdHJpa2U=?=

    datagrid memory leak?

    =?Utf-8?B?Y3liZXJzdHJpa2U=?=, Jan 3, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    484
    =?Utf-8?B?Y3liZXJzdHJpa2U=?=
    Jan 3, 2005
  2. s.subbarayan

    Dynamic memory allocation and memory leak...

    s.subbarayan, Mar 18, 2005, in forum: C Programming
    Replies:
    10
    Views:
    756
    Eric Sosman
    Mar 22, 2005
  3. Richard Heathfield

    Leak or no leak ??

    Richard Heathfield, Jul 10, 2006, in forum: C Programming
    Replies:
    4
    Views:
    376
    Richard Heathfield
    Jul 10, 2006
  4. cham
    Replies:
    5
    Views:
    791
  5. Mark Probert
    Replies:
    4
    Views:
    356
    Mark Probert
    Feb 9, 2005
Loading...

Share This Page