-
free memory?
I am using a CStringArray in my program. I wish to not only free the memory associated with the pointers to the strings in the array (as is done with RemoveAt() and RemoveAll()), but I also wish to free the memory allocated to the actual strings. MSDN doesnt list a function for doing this. How do I do it manually?
Thanx
-
Re: free memory?
hi
check the CString::FreeBuffer()
Regards
SKP
Be sure to rate answers if it helped, to encourage them.
-
Re: free memory?
Do you mean CString::ReleaseBuffer()? I don't see a CString::FreeBuffer(). So, I would have to loop through the array, set each string to "", and call ReleaseBuffer() on each? If I understand it all right, I think that's what I need to do. Seems like there would be an easier way.
-
Re: free memory?
I'm just getting this back at the top. Could somebody tell me if there is an easier way?
-
Re: free memory?
Do you see memory leaks?
Read in MSDN about CStringArray:
"When a CString array is deleted, or when its elements are removed, string memory is freed as appropriate."
It is nice to be important, but more important to be nice.
-
Re: free memory?
thanks, the RemoveAt() and RemoveAll() functions were CObjectArray base functions and for CObjectArray they do not free the objects. But I guess in the case of CStringArray the strings are deleted. Perhaps the memory leaks I thought I had were related to my CTypedPtrArray and not the string array.
Appreciate the help.