On Saturday 26 October 2002 06:22, Brian Jones wrote: > Hey, I guess this answers that nagging question I had about how a JVM > is supposed to deal with native code memory allocation being somewhat > outside of the garbage collector arrangement in use...
:-) Of course, the garbage collector can not avoid operating system functions from allocating memory on their own. For some functions, a second version exists that takes a pointer to a buffer as an argument where the result can be stored. In that case you can ask your garbage collector for a certain amount of memory and use that. AFAIK there are TCP/IP related functions in Linux that insist on allocating memory. The memory management of Linux should be able to cope more or less with fragmentation. But very small Operating Systems running on tiny devices usually don't. However, in that case, they should provide functions that don't necessarily allocate memory. > In general I hate macros because I'm not one with the C compiler in > having it create the real source from a given input with macros, > etc. expanded. However you seem to have proved out some system of > macros that works for a lot of strange environments and that is > encouraging. Probably most Java programmers don't like macros. But for C programmes, macros can hardly be avoided. We decided to use macros here because in many cases, quite similar native functions are provided by different operating systems. Maybe only the data types differ or the order of the arguments. In those cases, a macro is abstraction enough and causes no runtime penalty. If for a special OS something more has to be done, the macro can still resolve to a function call. > Thanks for helping us keep some perspective. It's easy to forget or > casually ignore these systems sometimes when it isn't what you're > directly concerned with or working on. I know. We started with Linux and Solaris as target systems. But since we had to support many different systems we had to find a solution to make this easier. It's somehow ironical that we just reached a fixed point now that we do this again, but maybe the second time, this is made faster. Have a nice weekend, Andy. -- aicas GmbH * Hoepfner Burg /"\ ASCII Ribbon Campaign Haid-und-Neu-Straße 18 * 76131 Karlsruhe \ / No HTML or RTF in mail http://www.aicas.com X No MS-Word in mail Tel: +49-721-663 968-24; Fax: +49-721-663 968-94 / \ Respect Open Standards _______________________________________________ Classpath mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/classpath