-
How to avoid OutOfMemoryError
In my information retrieval project, I have to build a vector space model. There are three arrays, i.e. a string array IndexTerm[i], a string array FileName[j], and a double array weight[i][j]. The total number of the files is about ten thousand, while the number of index terms might be twenty thousand. This causes a serious problem, i.e. java.lang.OutOfMemoryError
Could anybody tell me how to avoid this without reducing the number of files and index terms?
-
There's the "MicroSoft" answer: Throw hardware at it. More RAM.
Then there's the java.lang.management package. I have not used these classes yet, but I see things there like java.lang.management.MemoryUsage that sound tantilizing. Perhaps that will be of use.
-
Look at the heap size switches available for the java runtime engine reserving memory - or use a data structure for managing your files which doesn't need to have them all in memory at the same time.
-
Hi everyone,
 Originally Posted by Laszlo
Then there's the java.lang.management package. I have not used these classes yet, but I see things there like java.lang.management.MemoryUsage that sound tantilizing. Perhaps that will be of use.
Quite interesting but after looking at those classes from what i get itss only used to monitor memory and not allocate more memory. If i have understood wrongly maybe you could ellaborate a bit in detail on the using this class to increase memory during runtime
I had a similar problem as the OP a few months ago but what i did was to write my own application launcher. From there i would use the jar command to create another jvm but this time using the -Xmx flag thus setting the maximum amount of memory i want use but in my case it was around 800MB - 1GB. I used this way because i could not find anyway to increase the memory during runtime
Richard West
-
 Originally Posted by nspils
Look at the heap size switches available for the java runtime engine reserving memory - or use a data structure for managing your files which doesn't need to have them all in memory at the same time.
Thank you very much. But could you further explain how to increase the heap size if I'm using JBuilder, and how to manage the files which doesn't need to have them all in memory at the same time. Thanks.
-
You can specify how large your heap will start at with the JVM command line parameter -Xms. But that will not affect the limitations on how much memory is available to the JVM. You may be able to get a little extra memory by reducing your JVM stack size with the -Xsssize command line parameter.
As for how to manage your data, you haven't given enough information to know what in the world you're doing or how to optimize it. What is the purpose for loading ten thousand pages into RAM? Whatever you're doing, can it be done in pieces in stead of all at once?
Similar Threads
-
By byrdley20 in forum Java
Replies: 0
Last Post: 01-16-2006, 01:44 PM
-
By moni_boj in forum Database
Replies: 2
Last Post: 04-28-2003, 10:22 AM
-
Replies: 0
Last Post: 06-01-2002, 09:03 AM
-
By Amy in forum VB Classic
Replies: 4
Last Post: 03-22-2002, 11:40 AM
-
By basicOfbasic in forum VB Classic
Replies: 6
Last Post: 11-11-2000, 09:11 AM
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