• 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

OutOfMemoryError!!!

 
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,
I just wrote my first Sequence Alignment program and it did work fine for DNA sequences of lengths 5k and odd. But the problem comes as I use little longer sequences, the programs throws back OutOfMemoryError! Essentially the point where Im(or my JVM is)getting stuck is as follows:
char [][]myChar = new char[6000][6000];
The same code works fine when the 2-d array is of this dimension: 6000x5500.
Im using a 256MB RAM Machine and this line of code(mentioned above) would need 32MB which should not be a problem. Can someone explain me how do I overcome this problem...is there any way by which I can increase the memory allotted by JVM for the application at runtime ?
Thanks in advance
Sri Jyothsna.Y.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


.is there any way by which I can increase the memory allotted by JVM for the application at runtime ?


Yep. Use the -XmxNNm switch, where NN is a number of megabytes to use for the Java heap. The default is commonly 64. So
java -Xmx128m MyClass
would run MyClass with twice the normal heap size.
 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ernest and Jyothsna,
I think that would be a good way to do it. Make sure ur variable scoping is right. Then try making a call to gc. I've heard that this does help.
Regards,
Vinod.

Originally posted by Ernest Friedman-Hill:

Yep. Use the -XmxNNm switch, where NN is a number of megabytes to use for the Java heap. The default is commonly 64. So
java -Xmx128m MyClass
would run MyClass with twice the normal heap size.

 
reply
    Bookmark Topic Watch Topic
  • New Topic