winapi - Sharing GlobalAlloc() memory from DLL to multiple Win32 applications -
winapi - Sharing GlobalAlloc() memory from DLL to multiple Win32 applications -
i want move caching library dll , allow multiple applications share single pointer allocated within dll using globalalloc(). how accomplish this, , result in important performance decrease?
you , there won't performance implication single pointer.
rather utilize globalalloc
, legacy api, should opt different shared heap. illustration simplest utilize com allocator, cotaskmemalloc
. or can utilize heapalloc
passing process heap obtained getprocessheap
.
for example, , neglecting show error checking:
void *mem = heapalloc(getprocessheap(), heap_zero_memory, size);
note need worry heap sharing if expect memory deallocated in different module created. if dll both creates , destroys memory can utilize plain old malloc
. because modules live in same process address space, memory allocated module in process, can used other module.
update
i failed on first reading of question pick on possibility may wanting multiple process have access same memory. if that's need possible memory mapped files, or perhaps form of ipc.
winapi memory dll
Comments
Post a Comment