• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Out of memory

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I have scenario in which i get the OutOfMemory Exception.

Let me say what i am doing, I have a PDA which is WM2005 device.I am downloading the GZIP compressed file from the server and i am dumping this file in the cache disk or external memory(SD) ,the size of the compressed file is 675KB ,if i uncompress it ,the size would be 17MB.

Here is my question,

I get Memory problem ,when i uncompress the file at runtime like this


and i am reading the primitive value out of the stream.

Now i thought of doing like ,
1) Dumping the compressed file in the external memory .
2) Uncompressing or extracting the file in the same external memory.
3) Processing the data from the uncompressed file.

Can anyone of you suggest if i go for the second approach ,will i solve the out of memory propblem and please let me know the difference in decompressing the file at runtime and reading the data from the uncompressed file?
 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Venkat,

First try using System.gc(). If this doesn't work, increase the virtual memory to get rid or out of memory errors.

You can increase the virtual memory by using "java -Xmx512m" command. You can try out even keeping "java -Xmx1024m"....
or
You can set this in java control panel, you can go through the following link with a video which shows how to set it:
http://www.auditmypc.com/java-memory-xmx512.asp

Regards,
Kiran.
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by K Kiran Kumar:
You can increase the virtual memory by using "java -Xmx512m" command. You can try out even keeping "java -Xmx1024m"....



Did you read Rajan's post? His program is running on a PDA. It probably doesn't have 512mb RAM. And invoking System.gc() is rarely helpful (and can impede performance).
Rajan, your code leaves much to the imagination. Are you attempting to extract the file to memory, then process it? Probably a Bad Idea. Can you read a small chunk of the file, process it, then discard it and retrieve another? That would be much easier on memory use.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is in the compressed zip file?

Perhaps there is a more compact way to represent the data to reduce the memory needed to unpack it. For example, if it is characters in the ASCII (0-128) range, a byte[] will take half the space that String representation takes.

Bill
 
reply
    Bookmark Topic Watch Topic
  • New Topic