I did HANDLE hHeap = GetProcessHeap(); which gives me the handle to the heap of the process then i did
DWORD dsize = 468178553;
(near pointer)PBYTE pBuffer = (LPBYTE)HeapAlloc(hHeap, 0, size);
but here i got pBuffer as NULL and then i did
_stprintf( (TCHAR*)pBuffer,"", , ,);
here my program crashes.............may be its bcoz the heap memory is less than
dsize(468178553)................how to solve this.........do i need to use a far pointer(LPBYTE).....plz help..
risa
0
Light Poster
Recommended Answers
Jump to Post> here my program crashes.............may be its bcoz the heap memory is less
yes. to specify a larger process default heap size for your executable image, use the/HEAP
linker switch. http://msdn2.microsoft.com/en-us/library/f90ybzkh.aspx
to allocate 468 MB of memory, the heap is not a good choice. useVirtualAlloc
…
Jump to PostCurently allocated(4044MB)! if you are on a 32-bit machine, the address space is almost exhausted; you certinly won't get another 400 MB+ memory.
are you allocating this memory just once in your program?
if not are you freeing yhe allocated memory (VirtualFree with MEM_RELEASE) after use?
All 6 Replies
vijayan121
1,152
Posting Virtuoso
risa
0
Light Poster
risa
0
Light Poster
vijayan121
1,152
Posting Virtuoso
mitrmkar
1,056
Posting Virtuoso
risa
0
Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.