[Gdal-dev] On Feature.setGeometryDirectly SWIG bindings
aaime at openplans.org
Sun Mar 18 11:38:38 EDT 2007
playing with java and OGR I had quite a bit of JVM
breakages due to inconsistent/conflicting memory
handling on either side of the JNI fence.
One that has been tricky to identify is Feature.setGeometryDirectly.
This issue is there because every SWIG wrapper
does deallocate its C++ counterpart when garbage collected,
and thus the OGR Feature that got is geometry thru setGeometryDirectly
is left with a dangling reference. (since garbage collection is not
predictable, the error may occur a few seconds later, leaving
you wondering what went wrong).
That function has no special handling... as is, it should
be removed from the bindings of any language that has
garbage collection and finalization to avoid memory
The following chapters in the Swig guide:
seem to provide a solution for that issue, other than removing
Did anyone every used those typemaps?
More information about the Gdal-dev