[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

gcc displaying bullshit allocation numbers? (was: Re: Ability to further support 32bit architectures)



Hi

On Thu, Jan 11, 2024 at 10:25:39AM +0100, Bastian Blank wrote:
> Linux 6.7 fails to build on at least i386 and armhf.  Even it now
> manages to make the compiler fail to allocate memory:
> | cc1: out of memory allocating 135266296 bytes after a total of 235675648 bytes

I just tried to find out what this numbers actually mean.

The first on is the allocation amount, so correct.  The printf spec is
however wrong, as the variable is a size_t (%zu) and not unsigned long
(%lu).

The second one is the return value of "sbrk(0) - $saved sbrk value".

https://github.com/gcc-mirror/gcc/blob/master/libiberty/xmalloc.c#L125-L132

The glibc malloc(3), which seems to be used in the background, uses both
brk(2) and malloc(2), so you can't really see how much you have ever
allocated using this technique.

Am I right in this?

Bastian

-- 
	"Life and death are seldom logical."
	"But attaining a desired goal always is."
		-- McCoy and Spock, "The Galileo Seven", stardate 2821.7


Reply to: