-
August 9th, 2001, 08:17 AM
#1
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
-
August 9th, 2001, 08:23 AM
#2
Re: free memory?
hi
check the CString::FreeBuffer()
Regards
SKP
Be sure to rate answers if it helped, to encourage them.
-
August 9th, 2001, 08:32 AM
#3
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.
-
August 9th, 2001, 09:09 AM
#4
Re: free memory?
I'm just getting this back at the top. Could somebody tell me if there is an easier way?
-
August 9th, 2001, 09:26 AM
#5
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.
It is nice to be important, but more important to be nice.
-
August 9th, 2001, 09:53 AM
#6
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|