[mapguide-internals] RFC60 - Memory Management & Object LifeCycle Issues between Mdf Parser and runtime Maps

UV uvwild at gmail.com
Fri Mar 20 00:15:08 EDT 2009


The style guide talks about auto_ptr and I have seen the Ptr<> template 
class being used in the code.

But so far I am using a std::list container for the collection of colors 
in the VectorLayerDefinition (making full use like sort90 and unique())
when creating the final Palette for the Image renderer.
Using the Ptr template classes on an STL container does not compile!

This now throws up some questions regarding the lifecycle of objectts

1) the MdfModel seems to have a limited lifespan.... however the 
VectorLayerDefinition is the source of the color table.
    if I take the MdfStrings from the VLD how long do the live? Can I 
keep some references or do I need to copy the Strings or Adopt them?
    Is the MdfModel shared between the runtime Maps or between sessions? 
Or is it always deserialized/serialized from a stream as a caching method?

2) Is there a possibility that the same runtime MgMap is being used for 
different baseMapGroups?

Can someone please shed some light on those lifecycle issues?
I try to investigate with the debugger but its quite tedious with so 
many threads....

I think this is essential to prevent memory leaks.....

Cheers


More information about the mapguide-internals mailing list