[uClibc]extra 300K on top of .text + .data + .bss in the beginning of main()

Ilguiz Latypov ilatypov at superbt.com
Mon Apr 29 19:23:08 UTC 2002


Hello,

Sorry for the question not directly related to the uClibc library.  There
was no answer to it in uClinux mailing list.

Can libraries allocate memory before the main() function gains control?

Simple daemons like flatfsd or inetd take about 250-300K on the m68knommu
platform (MCF 5307 CPU).

However, another user space application compiled against glib takes twice
as much.  Is it possible that memory allocation happens in libraries
before the beginning of main()?

The content of /proc/PID/statm is almost the same in the very beginning of
the main() function.

The size of the .bss segment is about 2K only.

Thanks,

Ilguiz

=========================================================================
   # ps
      [...]
      75 root     S    hcid: processing events              
      77 root     R    ps 
   # cat /proc/75/statm
   564608 564608 0 191024 0 70864 0
   # 
=========================================================================

   Nov 30 00:13:48 sbt1000 user.info syslog: malloc stats in hcid.c (336): 
                                             524224 524224 0 191024 
                                             0 70864 0  

=========================================================================
hcid.gdb:     file format elf32-m68k
hcid.gdb
architecture: m68k, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x00000008

Program Header:
    LOAD off    0x00002000 vaddr 0x00000000 paddr 0x00000000 align 2**13
         filesz 0x000340d0 memsz 0x00034984 flags rwx
private flags = 0:

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         0002ea30  00000000  00000000  00002000  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .data         000056a0  0002ea30  0002ea30  00030a30  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  2 .bss          000008b4  000340d0  000340d0  000360d0  2**2
                  ALLOC
  3 .stab         00001eb4  00000000  00000000  000360d0  2**2
                  CONTENTS, READONLY, DEBUGGING
  4 .comment      00001a40  0000554d  0000554d  00037f84  2**0
                  CONTENTS, READONLY
  5 .stabstr      00003699  00001eb4  00001eb4  000399c4  2**0
                  CONTENTS, READONLY, DEBUGGING
=========================================================================





More information about the uClibc mailing list