Handmade Hero»Forums»Code
17 posts
Platform-ind.. Game Memory (ep 14) virtualalloc
SO I am trying my hand at the virtualalloc stuff but then on a mac, originally I imagined it would just be the same as linux, which supposedly uses mmap for that. http://en.wikipedia.org/wiki/Mmap

sadly that doesn't work on osx, (mmap: Operation not supported by device)
I cannot really find any alternative either.

can anyone point me to a solution ?
17 posts
Platform-ind.. Game Memory (ep 14) virtualalloc
Edited by nikki on
oops googling for 'virtualalloc mac' points me towards a forum post on this domain ;)
https://forums.handmadehero.org/i...p/forum?view=topic&catid=4&id=119
so that might be my answer, don't know what I was googling before 'mmap osx' I suppose
105 posts
Platform-ind.. Game Memory (ep 14) virtualalloc
Yes, 'vm_allocate' (or in my case I use 'mach_vm_allocate') is what you'd use on Mac, although 'mmap' should be supported as well. I use it for memory-mapping the file for replay buffers (which is a few episodes down the road for you).
Chris Parsons
3 posts
Platform-ind.. Game Memory (ep 14) virtualalloc
See also https://github.com/itfrombit/osx_handmade_minimal for a code example of mmap working on OSX.

I've also had it working fine in my code -- perhaps it's the way you're calling it? Can you share more details?
17 posts
Platform-ind.. Game Memory (ep 14) virtualalloc
the problem is resolved thanks guys (the problem was not using a large enough adres) I followed http://davidgow.net/handmadepenguin/ch14.html and got it working just fine, thanks