Select to view content in your preferred language

Dispose() not working on core objects created on a SDE database (oracle)

445
2
09-24-2024 07:36 AM
MartinTyberg
Emerging Contributor

Hi - I'm noticing that if I create an object derived from CoreObjectsBase such as FeatureClassDefinition (via FeatureClass.GetDefinition()), and I call Dispose() on it when I'm done, its memory is released if working on a File Geodatabase. However, the memory is not released (tested in ArcGIS 3.3) if working on a SDE geodatabase (oracle in my case). Has anyone observed this? And if so, is this a bug and/or is there a way to overcome this?

Thanks,

Martin

0 Kudos
2 Replies
Aashis
by Esri Contributor
Esri Contributor

@MartinTyberg , Have you reviewed the conceptual doc describing how Pro SDK handles the resources? Your code might unintentionally acquires Core.Data instances . Could you share your code snippet?

0 Kudos
MartinTyberg
Emerging Contributor

Hi Aashis,

Thank you for your response. I've read the conceptual document before and have been careful to follow its guidelines. Here is my code snippet that leaks for an SDE db (Oracle) but not for a file gdb:

FeatureLayer featureLayer = m_mapView.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().Where(layer => layer.Name == mapLayer.Name).FirstOrDefault();
using (FeatureClass featureClass = featureLayer.GetFeatureClass())
{
    using (FeatureClassDefinition featureClassDefinition = featureClass.GetDefinition())
     {
         if (featureClassDefinition.GetShapeType() == ArcGIS.Core.Geometry.GeometryType.Multipoint)
	     {
		//do something
	     }		
      }
}
0 Kudos