Skip to main content
GameDev.net gamedev.net
🔒 Locked

GlobalAlloc shareable?

Started by Zoomby Feb 17, 2008 at 2:33 PM 0 replies 1k views
Original Post
Zoomby
Zoomby
Hi, there are many people who claim that memory got by GlobalAlloc can be shared between different processes. Other people say that GlobalAlloc is a vestige from win16 days, and it just calls HeapAlloc today (didn't check that myself). But then it would be all in the process's private virtual address space... What's the truth? And how does the Clipboard (SetClipboardData) for example share data between processes if the GlobalAlloc handle which it can get doesn't do it? Bye Zoomby
Yann L
Yann L
It's obsolete, and doesn't do what you think it does. GlobalAlloc will not allocate memory that can be shared between processes. It's just a (slow) wrapper around the standard heap allocation functions, for legacy code compatibility. There is no global heap on Win32/64 anymore.

If you want to share data between processes, look into pipes, memmapped files, or something like VirtualAllocEx. Memory mapped files are the preferred method.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.