My c# application crashes with a SynchronizationLockException in ogr_csharp.dll. The message is that an object synchronization method was called from an synchronized block of code in
OSGeo.OGR.Geometry.Dispose()
OSGeo.OGR.Geometry.Finalize()
My application has tens of thousands of Geometry objects read into memory from a FileGDB then analyzed in multiple threads. Note: I am reading the features in a SINGLE thread (FileGDB driver) THEN passing them to worker threads for analysis. No I/O is done asynchronously.
You should be able to call Dispose yourself rather than waiting for it to be called from the finalizer. That way you could ensure that it was called from the correct thread.
My c# application crashes with a SynchronizationLockException in ogr_csharp.dll. The message is that an object synchronization method was called from an synchronized block of code in OSGeo.OGR.Geometry.Dispose() OSGeo.OGR.Geometry.Finalize()
My application has tens of thousands of Geometry objects read into memory from a FileGDB then analyzed in multiple threads. Note: I am reading the features in a SINGLE thread (FileGDB driver) THEN passing them to worker threads for analysis. No I/O is done asynchronously.
This page on SWIG could be of some assistance: http://www.swig.org/Doc1.3/CSharp.html#csharp_memory_management_objects
I believe that as I'm processing the geometries, the garbage collector is trying to collect them (or some other member?) causing the exception.
Expected behavior and actual behavior.
Throws a SynchronizationLockException in Geometry.Dispose() (ogr_csharp.dll)
Steps to reproduce the problem.
Read in lots of Geometries (~2GB worth) and try to process them asynchronously.
Operating system
Windows 10 64 bit
GDAL version and provenance
2.1.3