OutOfMemoryError.

Dear Friends,

I am developing a software in which I need to keep millions of long data values.

I am storing them as LinkedList which conatains arrays of long values.

But, after few million long values program is throwing OutOfMemoryError.

I don't want my program to crash this way.

Is there any way to know this situation at this particular point I want to drop few arrays from the LinkedList.

Any help will be great.

[477 byte] By [amit_kumar_shah] at [2007-9-26 12:56:11]
# 1
try to use this:System.out.println("Total: "+Runtime.getRuntime().totalMemory()+" free: "+ Runtime.getRuntime().freeMemory());
aurelB at 2007-7-2 12:39:10 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 2

I looked into weak references But, I came to know that all weak refernces will be grabage coliected. But, I want to call a particular method which will manage the Objects.

> You may also want to look into using soft or weak

> references. (See the java.lang.ref.* package.)

amit_kumar_shah at 2007-7-2 12:39:10 > top of Java-index,Java HotSpot Virtual Machine,Specifications...