Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2006

Tip: Looking for answers? Try searching our database.

OutOf Memory exception under Eclipse when using relatively small amount of heap

Thread view: 
lennyw@comcast.net - 24 May 2006 16:56 GMT
Hi

I've tried an experimental app under Eclipse, that parses / transforms
a large (96Mb) xml file using the  java XSLT library DOM parser and
then tried the SAX parser. The program runs fine with smaller  XML
input files but exits with OutOfMemory with the large input file.

It seemed odd to me that I would get an out of memory because I'm set
up with quite a bit of physical memory.
My setup is:

WinXP Pro
768 Mb Ram
Eclipse -vmargs -Xmx1628M (biggest I can set it for, and still have it
load)
jvm 1.4.2_11
WinXP Virtual memory setup: Min 1149Mb Max 4095 (also tried "Let system
manage virtual memory")

It's a not heavily loaded desktop computer running little more than the
OS, an antivirus program and Eclipse.

To get a better idea of what's going on, I tried making a simple heap
test program
(below),which allocates in units of 1,0000,000 bytes until it crashes.
It consistently crashes with the array index i = 32. I find the value
32
to be a little suspicious, but looking through the various properties
of the test programs "project" parameters in Eclipse, I don't find any
limitations.

Can you give me some specific things to try or a general strategy I can
use
to isolate the cause of this problem?

Thanks in advance for any help.

Lenny Wintfeld

ps - here's the test program

public class TestHeapOverflow {

    public static void main(String[] args) {
        char [] [] arrayArray = new char[2000][];
        int i = 0;
        try {
            for (i = 0; i<2000; i++)
            {
            arrayArray[i]    = new char[1000000];
            }
        } catch (RuntimeException e) {
            e.printStackTrace();
            }
        finally{System.out.println("i="+i);}
    }

}
Oliver Wong - 24 May 2006 18:24 GMT
> Hi
>
[quoted text clipped - 11 lines]
> Eclipse -vmargs -Xmx1628M (biggest I can set it for, and still have it
> load)

   This "experimental app"; is it a plugin to Eclipse? If not, then you've
given Eclipse 1628MB of RAM, but not the app. The app runs in a seperate VM,
and is allocated memory seperately. In the run-configuration for the app,
add -Xmx128M or something like that to the "VM Arguments" section.

   - Oliver
lennyw@comcast.net - 24 May 2006 21:13 GMT
Wow thanks! I thought the Xmx in the -vmargs was for the vm that runs
the app. Your suggestion worked out great.

Lenny Wintfeld


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.