Hi, for all friends programmers:
This is the problem: I`m using CoGetMalloc function to allocate 1.600.000 byes in memory, and
this function give me almost 8 times this amount but when I try to fill these byte an error write protection fault occurs. Do someone known the answer ?
best regards for all
AFAIK the IMalloc Alloc method may allocate more than the requested number of bytes, but 8x seems way out of line. Can you post your code?
(Just to make sure :wink) CoGetMalloc gives you a pointer to a memory-allocator object, which you can then call Alloc from its IMalloc interface to do the actual memory allocation. The calls on the object are made using a com-style convention, so plain invoke won't work correctly.
Better post your code :bdg
Quote from: Tedd on October 06, 2007, 02:01:27 PM
(Just to make sure :wink) CoGetMalloc gives you a pointer to a memory-allocator object, which you can then call Alloc from its IMalloc interface to do the actual memory allocation. The calls on the object are made using a com-style convention, so plain invoke won't work correctly.
Yes. Using CoTaskMemAlloc instead of CoGetMalloc might do what you want, drjr.