Re: Huge numbers for incr passed to _sbrk
Freddie Chopin <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <[email protected]> |
Hello! Your implementation of sbrk() is actually wrong. It should return `highest_addr` value from _BEFORE_ it was incremented. For an example see here: https://github.com/DISTORTEC/distortos/blob/master/source/newlib/sbrk_r.cpp In your case you should make a copy of original `highest_addr` value, do some checking (also before actually modifying `highest_addr`) and only then increment `highest_addr`. The returned value should be the copy that you made at the very beginning. Whether it fixes your original problem is another matter. Regards, FCh