[mapguide][MG219][Modified] Fix MapAgent memory leaks

Walt Welton-Lair walt.welton-lair at autodesk.com
Fri Apr 14 05:01:24 EDT 2006


You can view the artifact detail at the following URL:

    https://mapguide.osgeo.org/servlets/Scarab/id/MG219

Type:
Defect

Artifact ID:
MG219 (Fix MapAgent memory leaks)

Modified by:
Walt Welton-Lair
waltweltonlair (walt.welton-lair at autodesk.com)

The following modifications were made to this artifact:
---------------------------------------------------------------------

-- Resolution Description set to new value:
Code fixes have been submitted.

At this point only the objects in the connection pool are displayed as leaked blocks in the dump, which is acceptable.

-- Resolution set to new value:
Submitted
-- Status Explanation set to new value:
Code fixes have been submitted.
-- Artifact Status changed:
Old value:
Assigned
New value:
Resolved
-- Developer Notes set to new value:
- I added CRT leak dump code to the MapAgent main method.  This is the same code that's in the server.

- At startup the MapAgent calls ACE::init() via a call to MgInitializeWebTier().  There should be a matching call to ACE::fini at shutdown.  I added this via a new MgUninitializeWebTier() method.

- Changed some static variables (including a buffer) in CgiPostParser to be member variables.  This allows the buffer to be deleted in the class destructor.  Note that we only create one instance of the CgiPostParser class, so there no extra allocations going on.

- Many of the actual leaks were caused by improper ref counting of objects, e.g.

Ptr<MgByteSink> sink = new MgByteSink(source->GetReader());

MgByteReader* byteReaderResult = mgprService->GetResourceHeader(&mgrIdentifier);

- There were also some non-ref-count related leaks in the WMS/WFS code.

-- Testing Notes set to new value:
Tested against the map agent running the web tier unit tests (including the WMS / WFS tests).

In order to dump leaks you have to:
- start up the MapAgent as a fast CGI process
- give it a bunch of requests
- attach to it using Visual Studio
- set a breakpoint in the main() method on the line where bShouldContinue is set to true
- give the agent one more request
  => your breakpoint should be hit
- force bShouldContinue to be false and finish running the agent
=> it will exit and any leaked blocks will be displayed



---------------------------------------------------------------------
This message was automatically generated by Project Tracker.








More information about the Mapguide_issues mailing list