This is MOSCH, a small porting and convenience library for UNIX programmers. It is released under the ZLib license, which is liberal, nonviral, and hence permissive of commercial use.
I wrote MOSCH for two reasons:
realloc()'s behavior.)
This could be particularly nice for string handling, a nasty area that C
programmers struggle with.I have tried to reproduce all relevant portions of the Classic/Carbon
Memory Manager. Of course the Mac OS handled memory in a very different way
back in the pre- OS X days, so there are a lot of architecture-specific
routines like CheckAllHeaps() that are simply no-ops in MOSCH.
MOSCH.h should be self explanatory, there are tons of preprocessor switches
you probably don't need to worry about. If you want documentation, I
recommend Inside Macintosh: Memory at:
Download MOSCH initial release
main.c and the Makefile produce a stupid test application that should at
least indicate whether or not MOSCH is broken on your platform. I have
compiled and run it under:
Just like you would the Mac OS Memory Manager! One difference: MOSCH
uses the type MOSCH_Handle instead of Handle to avoid
possible namespace collisions. If you want to just use the latter, or if you
are porting Mac code, you can do like I did in the test app: define
Handle as MOSCH_Handle.