[Insight-users] Memory Allocation Error in Java

Luis Ibanez luis.ibanez at kitware.com
Wed Dec 15 18:23:32 EST 2004


Hi Evert,

Thanks for trying the command line options for java.



It is now time for "Plan B".



The question to answer is:

      What are you doing in your pipeline that
      is taking so much memory (more than 1 Gb).  ?



Please give us a list of:


- The filters that you connected in your pipeline,

- The size (in pixels) of the input image,

- The pixel type that you are using for instantiating
   each one of the intermediate filters.



One thing that you may want to try is to enable the
ReleaseDataFlag() in all the filters in your pipeline.
This flag allows you to release memory of the filter
as their Update() progress in the pipeline. In this
way you discard memory that is no longer needed.


Please let us know about the information in the list
above.


    Thanks



       Luis



-----------------------
Evert van Velsen wrote:

> Hi Luis,
> 
> the fist two options you proposed, didn't help unfortunately. The memmory
> usage was already at it max; even 1GB :S
> Also I tried to adapt line 186 into the following:
> throw MemoryAllocationError(__FILE__, __LINE__, "Failed to allocate memory
> for image: "+size,"ImportImageContainer::AllocateElements");
> But the whole program crashed.
> 
> Do you have any other solutions to see how much memory had to be allocated?
> Otherwise I had to sepparate my ImageStack into subsamples I think.
> 
> Thanks,
> 
> Evert
> 
> 
> 
>>Hi Evert,
>>
>>The Java virtual machine has a natural limitation to the amount
>>of memory made available its processes.
>>
>>   http://java.sun.com/docs/hotspot/gc5.0/ergo5.html
>>
>>You may want to first attempt to increase the memory made available
>>to your program by the virtual machine.
>>
>>http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/java.html
>>
>>This can be done with the command line options for the "java"
>>command:
>>
>>"   -Xmsn
>>
>>     Specify the initial size, in bytes, of the memory allocation pool.
>>This value must be a multiple of 1024 greater than 1MB. Append the
>>letter k or K to indicate kilobytes, or m or M to indicate megabytes.
>>The default value is 2MB. Examples:
>>
>>        -Xms6291456
>>        -Xms6144k
>>        -Xms6m
>>
>>
>>-Xmxn
>>     Specify the maximum size, in bytes, of the memory allocation pool.
>>This value must a multiple of 1024 greater than 2MB. Append the letter k
>>or K to indicate kilobytes, or m or M to indicate megabytes. The default
>>value is 64MB. Examples:
>>
>>        -Xmx83886080
>>        -Xmx81920k
>>        -Xmx80m
>>
>>"
>>
>>
>>
>>If you still find memory allocation problems, you may want to add a
>>message to the file:
>>
>>         Insight/Code/Common/itkImportImageContainer.txx
>>
>>in line 186 in order to specify how much memory is trying to allocate.
>>
>>It is likely that some of the signed/unsigned convertions from Java to
>>C++ is creating a situation where an obscene amount of memory is being
>>requested for an image.
>>
>>
>>
>>
>>Please let us know what you find.
>>
>>
>>    Thanks
>>
>>
>>
>>        Luis
>>
>>
>>
>>------------------------
>>Evert van Velsen wrote:
>>
>>
>>>Hi there,
>>>
>>>when running my java-written ITK program, which I've combined with
>>>ImageJ,
>>>I received the following error:
>>>Error: java.lang.RuntimeException:
>>>c:\insighttoolkit-1.8.1\code\common\itkImportImageContainer.txx:186:Failed
>>>to allocate memory for image.
>>>
>>>The input of the program is a 200 slice 3d-image (tiff-format) of
>>>128x128,
>>>and the error occured when performing the ShapeDetectionLevelSetFilter
>>>with 200 seedpoints (one on each slice).
>>>I'm using ITK 1.8.1 with java 1.4.2_05
>>>
>>>Does anyone know how I can fix this problem?
>>>
>>>Thanks,
>>>
>>>Evert
>>>_______________________________________________
>>>Insight-users mailing list
>>>Insight-users at itk.org
>>>http://www.itk.org/mailman/listinfo/insight-users
>>>
>>>
>>
>>
>>
>>
>>
> 
> 
> 






More information about the Insight-users mailing list