1d3644a168
the compilers and linkers use ther own memory allocator. free memory is between hunk and hunk+nhunk. allocation works by checking if nhunk is bigger or equal to the amount needed, and if not, repeatedly call gethunk() until there is. after that, the allocated amount is added from hunk and subtracted from nhunk by the user. the problem was when the needed amount was bigger than the default NHUNK size gethunk() allocates per call. gethunk() would not actually grow nhunk, but instead just set hunk and nhunk variables to the last allocated block. this resulted in a infinite loop of calls to gethunk() until sbrk() would hit the maximum size for the BSS segment. this change makes gethunk() actually grow the hunk space, increasing nhunk, and only updating hunk when nhunk was previously zero. we assume that mysbrk() retuns increasing addresses and that the space between the previous hunk+nhunk and the new block base returned by mysbrk() is usable. |
||
---|---|---|
.. | ||
doc | ||
games/lib | ||
include | ||
lib | ||
man | ||
src |