At 16:26 +0200 14/5/03, Ruotger Skupin wrote: Is there a solution to allocate shared memory in two processes at the same address? (about 50-100MB) In general, no. Many of the shared memory APIs (for example, BSD's mmap and Mach's vm_map) allow you to specify the address where you want the memory mapped. However, there's no easy way to come up with an address to use. The memory map of a Mac OS X process is very dynamic and Apple has, and will continue to, shuffle it around to meet our goals (for example, the address range used to map frameworks changed between Mac OS X 10.1 and 10.2). If you know in advance all of the processes that need to use the memory, you could probe each of their memory maps (vm_region should work) to find an address that's currently free in all of the processes. If you want to allocate a range that's free in the current process and in other arbitrary processes that might connect to it, the best you can do is use heuristics that will be a future compatibility liability. My general advice is to use offsets from the base of the shared memory rather than pointers within your shared memory. With enough C++ hackery you can make these look like normal pointers. S+E -- Quinn "The Eskimo!" <http://www.apple.com/developer/> Apple Developer Technical Support * Networking, Communications, Hardware _______________________________________________ darwin-kernel mailing list | darwin-kernel@lists.apple.com Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-kernel Do not post admin requests to the list. They will be ignored.
participants (1)
-
Quinn