Allocate memory
Dimiter Stamenov
pamir@abv.bg
Wed Feb 13 10:39:00 GMT 2008
Thanks you all for your help - the problem really appeared not to be in memory allocation - it works fine. Sorry for this confusion.
The problem is in a jar file (poi.jar from apache poi project) - the whole jar is compiled successfully, but the application can not find a class which actually is in the jar file.
Do you have any idea how to fix it?
The stack trace is:
java.lang.NoClassDefFoundError: org.apache.poi.hpsf.SummaryInformation
at java.lang.Class.initializeClass(MyApp.exe)
at org.apache.poi.hpsf.PropertySetFactory.create(MyApp.exe)
at org.apache.poi.POIDocument.getPropertySet(MyApp.exe)
at org.apache.poi.POIDocument.readProperties(MyApp.exe)
at org.apache.poi.hwpf.HWPFDocument.<init>(MyApp.exe)
at org.apache.poi.hwpf.extractor.WordExtractor.<init>(MyApp.exe)
at org.apache.poi.hwpf.extractor.WordExtractor.<init>(MyApp.exe)
Thanks
Dimiter
>-------- ÎðèãèГГ Г«ГГ® ïèñìî --------
>ГЋГІ: "Boehm, Hans" <hans.boehm@hp.com>
>ГЋГІГîñГГ®: RE: Allocate memory
>Äî: Dimiter Stamenov <pamir@abv.bg>, "java@gcc.gnu.org" <java@gcc.gnu.org>
>Èçïðà òåГГ® ГГ : ÂòîðГГЁГЄ, 2008, Ôåâðóà ðè 12 23:47:03 EET
>----------------------------------
>
>Both the garbage collector and gcj have been used with much larger heaps, though I'm personally not sure how much of that has been done under Windows.
>
>How are you constructing the large strings? How long are the files?
>
>It would be good to look at the GC log. One particularly useful piece of information would be the heap size when it's failing.
>
>Hans
>
>> -----Original Message-----
>> From: java-owner@gcc.gnu.org [mailto:java-owner@gcc.gnu.org]
>> On Behalf Of Dimiter Stamenov
>> Sent: Tuesday, February 12, 2008 12:54 PM
>> To: java@gcc.gnu.org
>> Subject: Re: Allocate memory
>>
>> So Hans you think that allocating 128 MB is not a problem? Do
>> you mean that the compiled application should allocate it
>> automatically at runtime?
>>
>> The gcj version is 4.3 on 32-bit Windows XP. I am reading a
>> number of text files and put their contents in a
>> HashMap<String, String> (file name, text).
>>
>> In fact I need the text to be loaded in memory no matter in what way.
>>
>>
>>
>> >-------- ÎðèãèГГ Г«ГГ® ïèñìî --------
>> >ГЋГІ: "Boehm, Hans" <hans.boehm@hp.com>
>> >ГЋГІГîñГГ®: RE: Allocate memory
>> >Äî: Dimiter Stamenov <pamir@abv.bg>, "java@gcc.gnu.org"
>> <java@gcc.gnu.org> >Èçïðà òåГГ® ГГ : ÂòîðГГЁГЄ, 2008, Ôåâðóà ðè 12
>> 21:57:46 EET
>> >----------------------------------
>> >
>> >This is a reasonably new version of gcj? On a 32-bit
>> platform? LinkedList or ArrayList? Windows? Linux?
>> >
>> >Certainly allocating 128 MB should not be an issue.
>> Allocating a single 128MB contiguous object might be an
>> issue, at least if you do it repeatedly on a 32-bit platform.
>> >
>> >You can often get some idea what's going on by defining the
>> GC_PRINT_STATS environment variable, and looking at the
>> resulting GC log.
>> >
>> >Hans
>> >
>> >> -----Original Message-----
>> >> From: java-owner@gcc.gnu.org
>> [mailto:java-owner@gcc.gnu.org] >> On Behalf Of Dimiter
>> Stamenov >> Sent: Tuesday, February 12, 2008 10:58 AM >>
>> To: java@gcc.gnu.org >> Subject: Re: Allocate memory >> >>
>> In fact I know very well why it's running out of memory - I
>> >> must fill a large List which consumes the memory.
>> >>
>> >> When I use standard JRE I am starting application with
>> >> -Xmx128M argument and it is OK, but with gcj I don't know
>> >> what to do...
>> >>
>> >> May be in this case I can not use gcj at all, what do you think?
>> >>
>> >>
>> >> >-------- ÎðèãèГГ Г«ГГ® ïèñìî -------- >> >ГЋГІ: Andrew
>> Haley <aph@redhat.com> >> >ГЋГІГîñГГ®: Re: Allocate memory >>
>> >Äî: Dimiter Stamenov <pamir@abv.bg> >> >Èçïðà òåГГ® ГГ :
>> ÂòîðГГЁГЄ, 2008, Ôåâðóà ðè 12 19:52:33 EET >>
>> >----------------------------------
>> >> >
>> >> >Dimiter Stamenov wrote:
>> >> >> OK, but I am getting OutOfMemoryException - so what
>> could be done?
>> >> >
>> >> >Well, it's either really running out of memory or
>> you've hit a bug.
>> >> >
>> >> >> Do you mean that I have to rewrite that part of the
>> code in C++?
>> >> >
>> >> >I wouldn't have thought so. The stack trace should
>> give >> you an idea why it's >running out of memory.
>> >> >
>> >> >Andrew.
>> >> >
>> >> >
>> >> >> >Dimiter Stamenov wrote:
>> >> >> >> Hi,
>> >> >> >>
>> >> >> >> Is there any way in gcj compilation to tell the
>> >> compiled executable to allocate more memory?
>> >> >> >
>> >> >> >> I mean something like -Xmx JVM argument when
>> running >> a pure Java application.
>> >> >> >
>> >> >> >Not that I know of. It's not something you'd need, anyway:
>> >> >> >our gc doesn't allocate memory in a single block as
>> >> Sun's JVM >> >does.
>> >> >
>> >>
>> >
>>
>
More information about the Java
mailing list