-
Help: OutOfMemory error
Hi:
My code is to parse a large text format data file, create data object for
each record and save the object data in file. Within the loop of parsing
( read in a line a time ), I create a new object, fill it with data and then
output to file.
Since the data file is huge, after created 10711 objects, the program run
out of memory. I assume the Garbage Collector can release the memory resource,
but it seems not in time.
anybody can tell me how to mnanager the memory usage in such a situation?
Keven
yqian0@hotmail.com
-
Re: Help: OutOfMemory error
It sounds as if you are keeping a reference to each of your objects as you
create them. Otherwise, the garbage collector should be able to reuse their
memory. Are you storing them in an array or something like that? Check
your program. If you don't need the object after you output it to the file,
make sure you don't have any variables that refer to it.
Keven <yqian0@hotmail.com> wrote in message news:395baeb2$1@news.devx.com...
>
> Hi:
>
> My code is to parse a large text format data file, create data object for
> each record and save the object data in file. Within the loop of parsing
> ( read in a line a time ), I create a new object, fill it with data and
then
> output to file.
>
> Since the data file is huge, after created 10711 objects, the program run
> out of memory. I assume the Garbage Collector can release the memory
resource,
> but it seems not in time.
>
> anybody can tell me how to mnanager the memory usage in such a situation?
>
>
> Keven
> yqian0@hotmail.com
>
-
Re: Help: OutOfMemory error
If you are not keeping a reference to each of your objects, you can try to
explicitly run the java garbage collector by invoking the method System.gc().
You can modify your program to invoke the gc when a specific threshold has
been reached. Please note that the performance of your program may degrade
somewhat as it waits for the method call to the gc to return.
"Paul Clapham" <pclapham@core-mark.com> wrote:
>It sounds as if you are keeping a reference to each of your objects as you
>create them. Otherwise, the garbage collector should be able to reuse their
>memory. Are you storing them in an array or something like that? Check
>your program. If you don't need the object after you output it to the file,
>make sure you don't have any variables that refer to it.
>
>Keven <yqian0@hotmail.com> wrote in message news:395baeb2$1@news.devx.com...
>>
>> Hi:
>>
>> My code is to parse a large text format data file, create data object
for
>> each record and save the object data in file. Within the loop of parsing
>> ( read in a line a time ), I create a new object, fill it with data and
>then
>> output to file.
>>
>> Since the data file is huge, after created 10711 objects, the program
run
>> out of memory. I assume the Garbage Collector can release the memory
>resource,
>> but it seems not in time.
>>
>> anybody can tell me how to mnanager the memory usage in such a situation?
>>
>>
>> Keven
>> yqian0@hotmail.com
>>
>
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks