[Mono-devel-list] malloc and free on CLI

Miguel de Icaza miguel at ximian.com
Sat Jul 16 19:05:15 EDT 2005


> How should I implement malloc and free on CLI? I've come up with a couple of
> ideas, but none of them seem particularly good to me:
> - P/Invoke to native malloc and free
>   Problem: The binary becomes tied to the details of the underlying platform to
> pull in a malloc from the appropriate library. Binary portability is lost.

The advantage of using P/Invoke for every externally defined methods is
that there is no difference between handling malloc/free and handling
any other library call.

There is no reason to special case this.

> - The mysterious "localloc" instruction.
>   Problem: I think it is completly unrelated to malloc(), so never mind.

This is related to implemeting C's "alloca()" routine (which is
specially handled by the compiler, while malloc/free are not).


More information about the Mono-devel-list mailing list