Subj : Re: where can I find a malloc for standalone programs ? To : comp.programming From : CBFalconer Date : Fri Aug 19 2005 07:42 pm DEMAINE Benoit-Pierre wrote: > .... snip ... > > problem occurs about malloc: since there is no kernel, nor system, > nor stdlib, there is no malloc defined. I can not either link my > application against a stdlib stolen to any system, since I have no > kernel, and that stdlib would not know the addresses of memory > pages available. > > Thus, I need a new malloc that is initialised by a special > initialisation call, with begin and end adresses of memory space, > and implements malloc() and free(), and is aware of endianness, > bus width, alignment problems ... Please restrict your line length to about 65 chars. Take a look at nmalloc. It is written for the DJGPP system, and depends on the sbrk mechanism. However, for testing purposes I created a module called fakesbrk, which allowed all operations in user space. The debug statements (which are not enabled by default) use other system routines, but apart from those I think only memcpy and memmove are needed. It also has provision for a useful user debug addition. -- "If you want to post a followup via groups.google.com, don't use the broken "Reply" link at the bottom of the article. Click on "show options" at the top of the article, then click on the "Reply" at the bottom of the article headers." - Keith Thompson .