Out of Memory exception

Posted on 2006-06-02
Last Modified: 2008-02-01
Our application is currently using java version 1.2.2. Recently, we have experienced Out Of Memory exception and I believe this occured as they were multiple threads running at this time using buffer space. Is this a known issue. Can this be resolved after migrating to Java 1.4? Please suggest.Thanks for your help.
Question by:g46905
    LVL 15

    Assisted Solution

    1.4 can be a solution or you can try :

    increasing the amount of memory available to the VM using -Xmx command line option
    eg. to give it 512mb

    java -Xmx512m .... if that is availabel in 1.2 if not try 1.4 if you experience the same problem
    then increase the amount of memory of your application using the above solution.
    LVL 14

    Expert Comment

    for 1.2

    java -Xms32m -Xmx128m

    Xms: the initial amount of memory allocated for your program
    Xmx: the maximum amount of memory that can be allocated for your program
    LVL 92

    Assisted Solution

    OOM error occurs when the VM cannot fulfil a request for more memory.
    Ifd your application shouldn't require an excessive amount of memory then it could be caused by a memory leak.
    Make sure you remove any references to variables when they are no longer needed.
    You could use a profiler to determine where your memory was being used.
    LVL 24

    Expert Comment

    g46905, if you have run this application for some time and suddenly one day this happens,
    may be only the use of it has grown.
    If you never applied the -Xmx  arguments, you are still running with a maximum of 64Mb.
    So may be nothing is wrong, just set it to -Xmx80m.
    If that runs ok, you know it: things grow a bit.
    Be prepared that one day 80Mb is not enough, so keep an eye on it.

    You can speed up things by specifying:
                                 -Xms64m -Xmx80m
    which gives you 64Mb at once, because you know you need it, growing permitted to 80.

    LVL 30

    Expert Comment

    >> Can this be resolved after migrating to Java 1.4?

    If you have to migrate then why not Java 5 ;) ?

    Author Comment

    I am currently using WSAD 5.1 and I believe this contains the required compiler to migrate to 1.5.Can a new compiler be added to WSAD?

    LVL 30

    Expert Comment

    I'm not sure because I don't have WSAD with me right now and when I worked with it, I worked with only Java 1.4. I'm not sure if WSAD 5 will support Java 5.
    LVL 24

    Expert Comment


    LVL 30

    Accepted Solution

    For development, though, WSAD 5.1 does not support Java 5 even if you try to add it as a JRE. The best bet is to use Eclipse.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Suggested Solutions

    Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
    Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
    Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
    Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now