S
Sean F. Aitken
Good afternoon,
We have an app that uses a CMap with CString types for values and
accepts LPCSTR as the parameter. The object being created is on the
heap (created dynamically). A leak detector we have is picking up the
CStrings as not being freed. Based on the CMap documentation, the
values are deleted when the CMap is destroyed. (In this case, the
value IS the CString itself, not a pointer to a CString) All the
examples I see indicate the use of pointers to CStrings, then in the
destructor (or calling routine), the CStrings referenced by the
pointers are individually deleted in a loop before the CMap is
destroyed.
Is there something fishy going on here that is causing the CString
values not to be deleted? Perhaps because we are using LPCSTR as
parameter values. Any help is greatly appreciated.
Thank you,
-Sean
We have an app that uses a CMap with CString types for values and
accepts LPCSTR as the parameter. The object being created is on the
heap (created dynamically). A leak detector we have is picking up the
CStrings as not being freed. Based on the CMap documentation, the
values are deleted when the CMap is destroyed. (In this case, the
value IS the CString itself, not a pointer to a CString) All the
examples I see indicate the use of pointers to CStrings, then in the
destructor (or calling routine), the CStrings referenced by the
pointers are individually deleted in a loop before the CMap is
destroyed.
Is there something fishy going on here that is causing the CString
values not to be deleted? Perhaps because we are using LPCSTR as
parameter values. Any help is greatly appreciated.
Thank you,
-Sean