>
> >After browsing some classpath native code it seems that malloc is used
> >for allocating native memory. I'm not sure how portable it is between
> >various VMs.
> >I'm afraid that in some cases it can just crash vm which manages brk by
> >itself. Maybe some level of indirection can be used (memory interface by
> >pointers, or just #defines).
>
> How often do we do this?
The real problem comes in when you use libraries such as Xlib or
any of the image compression/decompression/conversion libraries
(libpng, libgif, libungif, zlib... you name it) Some of those libraries
(those not all, some do have hooks to prevent this) will just call malloc()
themselves without giving you a change to do anything about it.
Btw, the problem is not that VMs manage brk() themselves. You can use
malloc() and brk() side by side.
The real problem is concurrency, namely that malloc() is not reentrant
on many systems.
- Godmar