Re: mallinfo arena and uordblks unintialized?

Grant Edwards <[email protected]> Tue, 17 Feb 2026 05:09:51 -0000 (UTC)
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
On 2026-02-17, Grant Edwards <[email protected]> wrote:
> On 2026-02-17, Grant Edwards <[email protected]> wrote:
>
>> I've implmented _sbrk_r() and have been testing malloc().  It's
>> calling _sbrk_r() as expected. I can see that _sbrk_r() runs out of
>> memory and malloc() fails after I've allocated the "expected" max
>> amount of memory.
>>
>> What's odd are the values returned by mallinfo().
>>
>> The initial values of arena and uordblks are a  large, apparently
>> random number.  For example, before the first malloc() call:
>>
>>     arena=4695456 ordblks=0, uordblks=4695456, fordblks=0
>
> I finally noticed that the initial value for arena/uordblks isn't
> random. It's the final value they were at before the program image was
> reloaded into RAM and restarted.

Rats. It looks like there's something wrong with my linker script. The
bss symbols from the malloc objects in the library (long with
bss._PathLocale) aren't being included in the .bss section that's
getting cleared on startup. There being located after the end of the
..bss section that contains all of the other uninitilized global/static
variables.

Sorry for the noise.

--
Grant