Sorry Martin,<br>I will rectify the statement in my previous reply: &quot;I guess that increasing the xmx, &quot;steals&quot; memory which could be used by native items.&quot;<br>I&#39;m saying that I have noticed this:<br>
when increasing xmx settings, the out of memory errors in the native method occurs with a smaller requested amount of data with respect to the case of a lower xmx set.<br>As an instance,&nbsp; Xmx1024 allows the native method to allocate only &lt;550 MB memory while Xmx16M allows to allocate up to ~820MB.
<br><br>Thanks for your help.<br><br>Regards,<br>Daniele<br><br><br><div class="gmail_quote">On Jan 4, 2008 6:05 PM, Daniele Romagnoli &lt;<a href="mailto:dany.geotools@gmail.com">dany.geotools@gmail.com</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi Martin,<br>I&#39;m using GDAL through JNI (by means of the SWIG&#39;s generated java bindings).
<br>However, I guess that increasing the xmx, &quot;steals&quot; memory which could be used by native items.<br><br>Regards,
<br><font color="#888888">Daniele.</font><div><div></div><div class="Wj3C7c"><br><br><div class="gmail_quote">On Jan 4, 2008 5:32 PM,  &lt;<a href="mailto:mchapman@texelinc.com" target="_blank">mchapman@texelinc.com</a>&gt; wrote:
<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Daniele,<br><br>Are you using gdal api through jni or are you calling one of gdals exe programs? &nbsp;Java limits the total memory for in-process dll&#39;s to whatever the xmx is set to minus whatever the jre needs. &nbsp;I have dealt with this using java before. &nbsp;You can either increase the xmx setting or call gdal from outside the java runtime, like a c++ exe. &nbsp;In any case, you will always be limited to the amount of memory on your machine.
<br>P.S. &nbsp;A good driver will use memory mapped file io (file channels in java NIO) for reading and writing which gives you a max file size of 1.8 Exobytes on windows and will consume minimal memory during execution...like a couple of MB. Unfortunately, most drivers don&#39;t use file channels. :)
<br><br>Martin<br><br>Sent via BlackBerry by AT&amp;T<br><div><div></div><div><br>-----Original Message-----<br>From: Frank Warmerdam &lt;<a href="mailto:warmerdam@pobox.com" target="_blank">warmerdam@pobox.com</a>&gt;<br>

<br>Date: Fri, 04 Jan 2008 11:09:19<br>To:Daniele Romagnoli &lt;<a href="mailto:dany.geotools@gmail.com" target="_blank">dany.geotools@gmail.com</a>&gt;<br><a href="mailto:Cc:gdal-dev@lists.osgeo.org" target="_blank">Cc:gdal-dev@lists.osgeo.org
</a><br>Subject: Re: [gdal-dev] In Memory Raster - allocation run out of memory on
<br> &nbsp; &nbsp; &nbsp; &nbsp;big sizes.<br><br><br>Daniele Romagnoli wrote:<br>&gt; Hi list,<br>&gt; I&#39;m trying to build a very big In Memory Raster Dataset (~1 GB) using<br>&gt; SWIG&#39;s Java Bindings on my Notebook (with Windows Vista, with 2GB ram)
<br>&gt;<br>&gt; When calling the java method memoryDriver.create(...) the following<br>&gt; error appears &quot;ERROR 2: Unable to create band arrays ... out of memory&quot;<br>&gt; which is thrown when the underlying calloc method can&#39;t successfully
<br>&gt; allocate memory.<br>&gt; I have performed some tests and tunings with the following conclusions:<br>&gt; - reducing the JVM Heap Size (using -Xmx command) allows to allocate a<br>&gt; bigger native memory portion (using -Xmx1024M allows me to allocate only
<br>&gt; &lt;550 MB memory while using -Xmx16M allows me to allocate up to ~820MB)<br>&gt; [Java Heap space and &quot;Native&quot; Heap space are managed separately]<br>&gt; - increasing the virtual memory, the result is the same (out of memory).
<br>&gt; - killing all unuseful processes -&gt; freeing more physical memory (~1.2<br>&gt; GB), the result is the same (out of memory))<br>&gt; Any setting allows me to allocate a max of ~840000 KBytes.<br>&gt;<br>&gt; Anyway, why having almost 
1.2 GB free physical memory and a 3GB virtual<br>&gt; memory setting (with ~2GB free) allows me only to create always ~840000<br>&gt; KBytes?<br>&gt; Does anyone know how memory is managed, how the calloc method operates
<br>
&gt; and whether an OS limitation exist?<br>&gt; Thank you very much.<br><br>Daniele,<br><br>I have no reason to believe this is a GDAL specific problem. &nbsp;I presume you<br>are running 32bit Windows Vista? &nbsp;If so, I believe any one process can have
<br>at most 2GB of heap space which in your case would presumably be split<br>between the JVM and non Java memory in the same process.<br><br>I think you could allocate larger in memory rasters if you were running Win64<br>

which has a very large potential virtual memory size per process.<br><br>PS. I started out this reply to tell you to check the ulimit command output<br>which reports per-process memory limits on linux before I realized you were
<br>using windows. &nbsp;I don&#39;t know if there is any equivelent thing on windows.<br><br>Best regards,<br>--<br>---------------------------------------+--------------------------------------<br>I set the clouds in motion - turn up &nbsp; | Frank Warmerdam, 
<a href="mailto:warmerdam@pobox.com" target="_blank">warmerdam@pobox.com</a><br>light and sound - activate the windows | <a href="http://pobox.com/%7Ewarmerdam" target="_blank">http://pobox.com/~warmerdam</a><br>and watch the world go round - Rush &nbsp; &nbsp;| President OSGeo, 
<a href="http://osgeo.org" target="_blank">http://osgeo.org</a><br><br></div></div>_______________________________________________<br>gdal-dev mailing list<br><a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org
</a><br><a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br></blockquote></div><br><br clear="all"><br></div></div>-- <br>-------------------------------------------------------
<div><div></div><div class="Wj3C7c"><br>Eng. Daniele Romagnoli <br>Software Engineer<br><br>GeoSolutions S.A.S.<br>Via Carignoni 51<br>55041 Camaiore (LU)<br>Italy<br><br>phone: +39 0584983027<br>fax: &nbsp; &nbsp; +39 0584983027<br>
mob: &nbsp; +39 328 0559267<br><br><br>
<a href="http://www.geo-solutions.it" target="_blank">http://www.geo-solutions.it</a><br><br>-------------------------------------------------------<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>-------------------------------------------------------<br>Eng. Daniele Romagnoli <br>Software Engineer<br><br>GeoSolutions S.A.S.<br>Via Carignoni 51<br>55041 Camaiore (LU)
<br>Italy<br><br>phone: +39 0584983027<br>fax: &nbsp; &nbsp; +39 0584983027<br>mob: &nbsp; +39 328 0559267<br><br><br><a href="http://www.geo-solutions.it">http://www.geo-solutions.it</a><br><br>-------------------------------------------------------
<br>