Timeline for ArcObjects C# memory management - Out of memory exception
Current License: CC BY-SA 4.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 3, 2020 at 22:45 | history | edited | Kadir Şahbaz | CC BY-SA 4.0 |
deleted 698 characters in body
|
Jan 14, 2020 at 2:22 | comment | added | Michael Stimson | Have a read of community.esri.com/thread/66863 where Esri indicates that you shouldn't be using ComReleaser but dispelling properly with Marshal.ReleaseComObject (I think it's System.Runtime.Marshal.ReleaseComObject) - the GC has a hard time ageing Esri interfaces so as memory pressure increases the GC will clean up objects that it thinks aren't in use, all old and current Esri objects seem to have the same age and are cleaned up indiscriminately eventually releasing the one you're currently using... this is a distillation of an enormous number of facepalm moments. | |
Jan 14, 2020 at 2:16 | comment | added | Michael Stimson | I just noticed in passing Map map = (Map)mapDoc.Map[i]; is redundant and incorrect, you want the interface not the class. IMapOverposter overposter = (IMapOverposter)mapDoc.Map[i]; is the correct way to get the IMapOverposter. Out of memory doesn't mean you've run out of memory it means the garbage collector has cleaned up an object you are trying to use, to fix call GC.Collect() when you're opening/closing a new map object to dispel the ghost of the previous handle. Did you use the ArcObjects template to create your code? If not I would strongly advise doing so to get the foundation right. | |
Jan 3, 2020 at 22:02 | answer | added | danielm | timeline score: 2 | |
Jan 3, 2020 at 11:54 | history | edited | Vince | CC BY-SA 4.0 |
removed benice, smiley, closing, and redundant signature; naming
|
Jan 3, 2020 at 9:20 | review | First posts | |||
Jan 3, 2020 at 9:23 | |||||
Jan 3, 2020 at 9:16 | history | asked | user1711690 | CC BY-SA 4.0 |