Opened 4 years ago

Closed 4 years ago

#2825 closed defect (fixed)

Memory leaks in GwsQueryEngine

Reported by: jng Owned by: jng
Priority: low Milestone: 4.0
Component: Server Version:
Severity: trivial Keywords:
Cc: External ID:

Description

From mapguide-users:

Hi all!

FdoFilter * IGWSQueryDefinition::Filter()
function returns "FdoFilter *" that is supposed to be wrapped in
FdoPtr<FdoFilter>, am I right?

then in next places it is not wrapped and causes memory leaks:
============================================
1) MapGuide\Server\src\Gws\GwsQueryEngine\GwsFeatureSourceQuery.cpp
in function:
CGwsPreparedFeatureQuery * CGwsFeatureSourceQuery::PrepareFeatureQuery(...)

we should replace next:
stat = pQuery->Init ( sellist, orderByCols, orderingOption, pFQuery->Filter
());

by:
FdoPtr<FdoFilter> pFilter = pFQuery->Filter();
stat = pQuery->Init(sellist, orderByCols, orderingOption, pFilter);

============================================
2) MapGuide\Server\src\Gws\GwsQueryEngine\GwsQueryDefinition.cpp
in function:
bool
GwsQueryDefinitionXmlHelpers::CompareQueries(IGWSQueryDefinition*
firstQuery, IGWSQueryDefinition* secondQuery)

we should replace next:
if(!GwsQueryDefinitionXmlHelpers::CompareToStringValues(firstQuery->Filter()
, secondQuery->Filter()))

by:
FdoPtr<FdoFilter> pFirstQuryFilter = firstQuery->Filter();
FdoPtr<FdoFilter> pSecondQuryFilter = secondQuery->Filter();
if(!GwsQueryDefinitionXmlHelpers::CompareToStringValues(pFirstQuryFilter.p,
pSecondQuryFilter.p))

I have catched those leaks during connection to SDF provider and after first
fix my leaks dissapeared.
I also have tried to connect to SHP provider with simular code but got
another memory leaks. I haven't figure out where they come from yet, but I
suppose it can be from SHP provider implementation side.
Myabe someone have some information about it?

Best Regards,
Artem

Change History (1)

comment:1 by jng, 4 years ago

Resolution: fixed
Status: assignedclosed

In 9737:

Plug several leaks in GwsQueryEngine. Reported by artem on mapguide-users mailing list.

Fixes #2825

Note: See TracTickets for help on using tickets.