jaysome wrote:
CBFalconer <cb********@yahoo.comwrote:
>"Frank W. Steiner" wrote:
>>>
I would be interested to get code to do memory allocation and
management, just as malloc and friends do, but using a predefined
memory pool - for example, a sufficiently large global array. I do
not want to reinvent the wheel, for I am sure this must exist
already. However, a quick Google search did not return anything
obvious. Maybe somebody in this group knows better?
See the debug mechanisms in nmalloc.zip, using fakesbrk. Initial
development was done using this. See:
<http://cbfalconer.home.att.net/download/>
nmalloc.c(73) : Error 322: Unable to open include file 'unistd.h'
You are not setting the appropriate debug constants. When that is
done it will use 'fakesbrk' instead, and you can exercise it
through the testing mechanism. I think. Possibly you are running
into the use of write in the debug mechanisms. At any rate, the
point was to read the code and see how fakesbrk could supply the
fundamental storage involved. nmalloc is designed for DJGPP, and
naturally has to be system dependent. The non-standard mechanisms
are minimized, so that the only unusual reliance is on sbrk in the
operational system. The debuggery uses write rather than fwrite,
because in action it has to function (in DJGPP) before the file
system has been initialized.
--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>