OutOfMemory and Swap Space

Discussion in 'Java' started by paddy_ganti@yahoo.com, Jun 21, 2005.

  1. Guest

    I have this strange issue with an Out Of Memory error thrown on a Sun
    JVM 1.4.1 residing on a Windows 2000 box.

    The Windows boxes is configured to have 4 GB physical RAM out of which
    2 GB is available to applications on their server. ( Based on this
    article at:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/4gt_ram_tuning.asp
    )

    Out of this 2 GB , we have 3 JVMs of heap size at 768 M. Thich means a
    total of 2034 Megs allocated only to Java processes implying a 2048 -
    2034 = 14 Megs left for other applications and most importantly swap
    space.

    I have -verbose:gc logs that tell me that initially a couple of full
    GCs happen followed by a monotonically increasing scavenges and just
    before the OOM some hectic full GCs happen apparently to reclaim some
    memory but never do.

    How important is the consideration of Swap Space in troubleshooting
    such an error. Since this is a production environment, I just wanted to
    have an idea before I go ahead and recommend a decrease in the heap
    sizes for this environment.

    Your assitance is greatly appreciated.
    -Paddy
    , Jun 21, 2005
    #1
    1. Advertising

  2. Wibble Guest

    wrote:
    > I have this strange issue with an Out Of Memory error thrown on a Sun
    > JVM 1.4.1 residing on a Windows 2000 box.
    >
    > The Windows boxes is configured to have 4 GB physical RAM out of which
    > 2 GB is available to applications on their server. ( Based on this
    > article at:
    > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/4gt_ram_tuning.asp
    > )
    >
    > Out of this 2 GB , we have 3 JVMs of heap size at 768 M. Thich means a
    > total of 2034 Megs allocated only to Java processes implying a 2048 -
    > 2034 = 14 Megs left for other applications and most importantly swap
    > space.
    >
    > I have -verbose:gc logs that tell me that initially a couple of full
    > GCs happen followed by a monotonically increasing scavenges and just
    > before the OOM some hectic full GCs happen apparently to reclaim some
    > memory but never do.
    >
    > How important is the consideration of Swap Space in troubleshooting
    > such an error. Since this is a production environment, I just wanted to
    > have an idea before I go ahead and recommend a decrease in the heap
    > sizes for this environment.
    >
    > Your assitance is greatly appreciated.
    > -Paddy
    >

    We had huge heap allocated and still got OOM's. Turned out to be the
    perm space, not the heap. Try setting -XX:MaxPermSize to 128MB
    Wibble, Jun 21, 2005
    #2
    1. Advertising

  3. Guest

    I have allocated a MaxPermSize of 256 M. Besides if it were a Perm Size
    thing, the heap would not be 100% utilized, Would it?

    I see that the heap is constantly utilized at 99% before the OOM
    occurs.

    -Paddy
    , Jun 21, 2005
    #3
  4. On Mon, 20 Jun 2005 22:31:07 -0700, paddy_ganti wrote:

    > I have allocated a MaxPermSize of 256 M. Besides if it were a Perm Size
    > thing, the heap would not be 100% utilized, Would it?
    >
    > I see that the heap is constantly utilized at 99% before the OOM
    > occurs.


    Could you have a "memory leak" by keeping references way past the
    natural expiration date? It can be frustratingly easy to have "dangling
    references". Just remember, anything reachable by means of a static member
    of any class will remain reachable for the entire lifetime of your
    application.

    I once worked on a project that tried to cache objects (only a limited
    number could exist, and often the same object would be requested more then
    once). To cut a long and painful story short: It is much better to
    allocate and destroy the same object 10000 times then to try and be smart,
    and keep it around after it should have died.

    --
    In pioneer days they used oxen for heavy pulling, and when one ox
    couldn't budge a log, they didn't try to grow a larger ox. We shouldn't
    be trying for bigger computers, but for more systems of computers.
    --- Rear Admiral Grace Murray Hopper
    Stefan Schulz, Jun 21, 2005
    #4
  5. asaguden Guest

    I have no direct answer, just some tips:

    We use jvmoptions 'Xrunhprof' and save to file, then use 'visualgc'
    (http://java.sun.com/performance/jvmstat/visualgc.html)
    to remotely monitor GC.

    Then we had some help from our 'server guy' who tweaked the GC. What we
    ended
    up with was '-server -Xms1024m -Xmx2048m -XX:+AggressiveHeap' in
    production
    with 2 CPU SUN/Solaris. The -XX options might be worth checking out,
    since they are targeted for different environments....

    We havent had any problems since.
    Hope I have provided some new info...
    -------------------------------------------------------------------

    wrote:
    > I have this strange issue with an Out Of Memory error thrown on a Sun
    > JVM 1.4.1 residing on a Windows 2000 box.
    >
    > The Windows boxes is configured to have 4 GB physical RAM out of which
    > 2 GB is available to applications on their server. ( Based on this
    > article at:
    > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/4gt_ram_tuning.asp
    > )
    >
    > Out of this 2 GB , we have 3 JVMs of heap size at 768 M. Thich means a
    > total of 2034 Megs allocated only to Java processes implying a 2048 -
    > 2034 = 14 Megs left for other applications and most importantly swap
    > space.
    >
    > I have -verbose:gc logs that tell me that initially a couple of full
    > GCs happen followed by a monotonically increasing scavenges and just
    > before the OOM some hectic full GCs happen apparently to reclaim some
    > memory but never do.
    >
    > How important is the consideration of Swap Space in troubleshooting
    > such an error. Since this is a production environment, I just wanted to
    > have an idea before I go ahead and recommend a decrease in the heap
    > sizes for this environment.
    >
    > Your assitance is greatly appreciated.
    > -Paddy
    asaguden, Jun 21, 2005
    #5
  6. Guest

    Stefan,

    Thats exactly what I feared. I will look into static members throughout
    my codebase but this forensic effort of determining exactly which
    object is leaky might take some specialised tools and time.

    -Paddy
    , Jun 21, 2005
    #6
  7. Guest

    Good to know them. In out environment we dont have -XX options because
    they were non standard but nevertheless if they help, I dont mind
    trying it out. I am already in favor of using "-XX:+DisableExplicitGC"
    but will investigate the utility of the Aggressive Heap parameter once
    I figure out the leak.
    , Jun 21, 2005
    #7
  8. Alan Krueger Guest

    Alan Krueger, Jun 22, 2005
    #8
  9. Guest

    Thank You Alan. Appreciate it.
    I just downloaded it and seems to offer a great potential in solving
    these kind of problems.

    -Paddy

    *- The sufficiency of my merit is to know that my merit is not
    sufficient-*
    , Jun 22, 2005
    #9
    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. Shuo Xiang

    Stack space, global space, heap space

    Shuo Xiang, Jul 9, 2003, in forum: C Programming
    Replies:
    10
    Views:
    2,863
    Bryan Bullard
    Jul 11, 2003
  2. Christian Seberino
    Replies:
    21
    Views:
    1,621
    Stephen Horne
    Oct 27, 2003
  3. Ian Bicking
    Replies:
    2
    Views:
    978
    Steve Lamb
    Oct 23, 2003
  4. Ian Bicking
    Replies:
    2
    Views:
    706
    Michael Hudson
    Oct 24, 2003
  5. Niels Dekker (no reply address)

    What swap is called when using std::swap?

    Niels Dekker (no reply address), Jul 19, 2006, in forum: C++
    Replies:
    4
    Views:
    974
    Niels Dekker (no reply address)
    Jul 20, 2006
Loading...

Share This Page