glibc 2.3.2 vs 2.1.3: increased memory usage

Hi all,

We're developing a STB with Geode+Sigma chips. We are currently porting our applications from gcc 2.95.3 + libc 2.1.3 to gcc 3.3 + libc 2.3.2 the good news is that the executable sizes decreased a lot with gcc 3.3, but there is a strange effect on the size of the data segment as seen in the proc filesystem:

running the following program:

main(int argc, char *argv[]) { char *data = malloc(1); *data = '\0'; while (1) { sleep(60); } }

yelds the following output from the /proc/[pid number]/status file:

********************************************************************* gcc 2.95.3 + libc 2.1.3:

Name: allocBigChunk State: S (sleeping) Tgid: 587 Pid: 587 PPid: 580 TracerPid: 0 Uid: 0 0 0 0 Gid: 0 0 0 0 FDSize: 32 Groups: VmSize: 1388 kB VmLck: 0 kB VmRSS: 596 kB VmData: 32 kB VmStk: 20 kB VmExe: 12 kB VmLib: 1240 kB SigPnd: 0000000000000000 SigBlk: 0000000080000000 SigIgn: 8000000000000006 SigCgt: 0000000380000000 CapInh: 0000000000000000 CapPrm: 00000000fffffeff CapEff: 00000000fffffeff

********************************************************************* gcc 3.3 + libc 2.3.2:

Name: allocBigChunk State: S (sleeping) Tgid: 29550 Pid: 29550 PPid: 29545 TracerPid: 0 Uid: 0 0 0 0 Gid: 0 0 0 0 FDSize: 32 Groups: VmSize: 1720 kB VmLck: 0 kB VmRSS: 580 kB VmData: 288 kB VmStk: 20 kB VmExe: 12 kB VmLib: 1344 kB SigPnd: 0000000000000000 SigBlk: 0000000080000000 SigIgn: 8000000000000006 SigCgt: 0000000380000000 CapInh: 0000000000000000 CapPrm: 00000000fffffeff CapEff: 00000000fffffeff

as you can see the libc 2.3.2 version allocates 288 kB in the data segment, versus 32 kB of the libc 2.1.3. Another effect is that with multithreaded applications the effect seems to be multiplied: for example with an application using 2 threads the data segments is roughly doubled with gcc 3.3 + libc 2.3.2. Although all the STB processes seem to consume more memory, according to proc filesystem, the free memory of the STB is roughly the same, according to /proc/meminfo. So the VmData of the status file seems to be bogus.

- Have anyone noticed the same effect?

- is it possible to configure libc to consume less memory?

Thanks in advance, Gianni

Reply to
luciano.montanaro
Loading thread data ...

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.