Re:HowTo : get malloc to work
I've been meaning to post this for awhile, but I am having an odd problem with the _sbrk function. It is a problem with the part of the code that checks if I'm exceeding available RAM.
With this code in place, I was having a problem where malloc was not allocating RAM, even though I knew I had enough. When I removed this code, everything worked fine. So I did some debugging....Turns out, even though I was requesting 20-some KB from malloc, the number passed to the _sbrk function was over 23 or 24K!
For now I just removed the check and make sure I have enough before asking for memory. But any ideas what is going on with this?
login or register to reply
|