<div dir="ltr">Does this happen when you use gdal_translate to copy the netcdf file to another format (say gtiff)?<div><br></div><div>I am not familiar with c# but there must be a way to compile gdal and you application to get the exact line of code that causes the crash?</div><div><br></div><div>Etienne</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 16, 2015 at 8:57 AM, Robbie Price <span dir="ltr"><<a href="mailto:PriceR@landcareresearch.co.nz" target="_blank">PriceR@landcareresearch.co.nz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-NZ" link="blue" vlink="purple">
<div>
<p class="MsoNormal">I’m having trouble converting some netcdf (version 3) files to Kea files using the GDAL C# bindings.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">The problem is some form of memory leak caused by the netCDF code (from what I can establish through various tests).<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">There are two issues:<u></u><u></u></p>
<p><u></u><span>1)<span style="font:7.0pt "Times New Roman"">
</span></span><u></u> A memory leak in this call (which I noticed, but can work around as I am only dealing with a small number of subdatasets)<u></u><u></u></p>
<p style="margin-left:72.0pt;text-autospace:none">
<u></u><span style="font-size:9.5pt;font-family:Consolas"><span>a.<span style="font:7.0pt "Times New Roman"">
</span></span></span><u></u><span style="font-size:9.5pt;font-family:Consolas">dsNetCDF = OSGeo.GDAL.<span style="color:#2b91af">Gdal</span>.Open(strNetCDF_DSN, OSGeo.GDAL.<span style="color:#2b91af">Access</span>.GA_ReadOnly);<u></u><u></u></span></p>
<p><u></u><span>2)<span style="font:7.0pt "Times New Roman"">
</span></span><u></u>A memory issue/leak pointer assignment causing a crash that I cannot trace the error reports as:<u></u><u></u></p>
<p class="MsoNormal"><span style="color:red"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="color:red">Managed Debugging Assistant 'FatalExecutionEngineError' has detected a problem in 'O:\Projects\KEA_ReadWrite\bin\x64\Debug\KEA_ReadWrite.vshost.exe'.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:red">Additional Information: The runtime has encountered a fatal error. The address of the error was at 0xebc85654, on thread 0x16ec. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or
non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">The error is consistent in nature but happens inconsistently in the code (between 1800 and 4000 bands) – here from another run:<u></u><u></u></p>
<p class="MsoNormal"><span style="color:red">Managed Debugging Assistant 'FatalExecutionEngineError' has detected a problem in 'O:\Projects\KEA_ReadWrite\bin\x64\Debug\KEA_ReadWrite.vshost.exe'.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:red">Additional Information: The runtime has encountered a fatal error. The address of the error was at 0xebc85654, on thread 0x199c. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or
non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">The error <i>MAY</i> be occurring more often only on lines handling string functions (?)<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Version Details<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Using MSVS 2010 (C#) and the following:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><a href="http://www.gisinternals.com/query.html?content=filelist&file=release-1600-x64-gdal-mapserver.zip" target="_blank">http://www.gisinternals.com/query.html?content=filelist&file=release-1600-x64-gdal-mapserver.zip</a><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<table border="1" cellpadding="0" style="background:white;border:solid #9999ff 1.5pt">
<tbody>
<tr>
<td style="border:solid silver 1.0pt;padding:1.5pt 6.0pt 1.5pt 6.0pt">
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:"Tahoma","sans-serif";color:#4f2107"><a href="http://download2.gisinternals.com/sdk/Download.aspx?file=release-1600-x64-gdal-mapserver/gdal-200-1600-x64-core.msi" target="_blank"><b><i><span style="font-size:13.5pt;font-family:"Segoe UI","sans-serif";color:#660066">gdal-200-1600-x64-core.msi</span></i></b></a><u></u><u></u></span></p>
</td>
<td style="border:solid silver 1.0pt;padding:1.5pt 6.0pt 1.5pt 6.0pt">
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:"Tahoma","sans-serif";color:#4f2107">3/15/2015 4:13 AM<u></u><u></u></span></p>
</td>
<td style="border:solid silver 1.0pt;padding:1.5pt 6.0pt 1.5pt 6.0pt">
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:"Tahoma","sans-serif";color:#4f2107">21556 kB<u></u><u></u></span></p>
</td>
<td style="border:solid silver 1.0pt;padding:1.5pt 6.0pt 1.5pt 6.0pt">
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:"Tahoma","sans-serif";color:#4f2107">Generic installer for the GDAL core components<u></u><u></u></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Basic scenario is converting from one file type to another but taking the meta info from the NetCDF and using as band name info in the Kea file. Input files have between 365 and 8000 bands but not large spatially (260*243).<u></u><u></u></p>
</div>
<br>
<hr>
<font face="Arial" color="Green" size="1"><br>
Please consider the environment before printing this email<br>
Warning: This electronic message together with any attachments is confidential. If you receive it in error: (i) you must not read, use, disclose, copy or retain it; (ii) please contact the sender immediately by reply email and then delete the emails.<br>
The views expressed in this email may not be those of Landcare Research New Zealand Limited. <a href="http://www.landcareresearch.co.nz" target="_blank">http://www.landcareresearch.co.nz</a><br>
</font>
</div>
<br>_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">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></div>