Memory leak when changing layers if the mxd layout contains legend

363
0
09-07-2011 07:28 AM
BinChen1
New Contributor II
Hello,

We created a server object extension which was used for cartographic output.
We let the user have the capability to change the layers on the fly. When this happens, we remove the layers from the layout and add some other layers (cloned from map server) to the layout.

After exporting the layout to a pdf file, we close the layout mxd file. We released the com objects by all the methods we can do (e.g, ComReleaser, Marshal.ReleaseComObject, ActiveView.Deactivate and so on.

After doing a lot of test, I found the memory leaking occurred when the layout contains one or more legends. I tried to clear the legend items and remove the legends from the layout but did not get the memory leaking fixed. Even if I remove the legends before changing the layers, memory still got leaked.

Does anyone have the similar experience or have any idea on this problem?

Any suggestions would be greatly appreciated.

Thanks,
Bin
Tags (2)
0 Kudos
0 Replies