|
-
Feb 20th, 2003, 01:00 AM
#1
Thread Starter
Hyperactive Member
Virtual Memory
Hi,
I am trying to allocate heaps of memory and keep on getting memory leaks. HeapAlloc() works, but VirtualAlloc() gives leaks:
Code:
LPSTR pRead = (LPSTR)VirtualAlloc(NULL, config.dwSendHeap+1, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
VirtualFree(pRead, config.dwSendHeap+1, MEM_DECOMMIT | MEM_RELEASE);
Anyone can help to trace the leak?
Thanks.
-
Feb 20th, 2003, 09:52 AM
#2
Frenzied Member
You're call VirtualFree wrong - with MEM_RELEASE flag the size has to be zero:
Code:
VirtualFree(pRead, 0L, MEM_DECOMMIT | MEM_RELEASE);
Why do you have four arguments? Typo?
-
Feb 20th, 2003, 03:50 PM
#3
Thread Starter
Hyperactive Member
Thanks that works
I got rid of MEM_DOCOMMIT & MEM_RESERVE
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
|