0
  1. sudo atop -R
  2. dd if=/dev/zero of=/dev/null # in a background tab

In atop, type m for memory details. Type /dd to search for dd. Result:

PID TID MINFLT MAJFLT VSTEXT VSLIBS VDATA VSTACK VSIZE RSIZE PSIZE VGROW RGROW SWAPSZ RUID EUID MEM CMD 1/1
...
29041 - 93 0 56K 1456K 176K 136K 210.0M 832K 255K 210.0M 832K 0K alan-sys alan-sys 0% dd

Let's snip the columns down to what I am most curious about:

PID VSTEXT VSLIBS VDATA VSTACK VSIZE RSIZE PSIZE VGROW RGROW SWAPSZ
...
29041 56K 1456K 176K 136K 210.0M 832K 255K 210.0M 832K 0K

What is this 210M VSIZE for?


$ rpm -q --whatprovides $(which dd)
coreutils-8.30-6.fc29.x86_64

1 Answer 1

2

It was not a heap memory allocation. It was a virtually mapped file of locale information. The mapped file was /usr/lib/locale/locale-archive. It is owned by the package glibc-all-langpacks. I.e. this is probably a file of messages in different languages.

$ gdb dd
...
(gdb) break main
Breakpoint 1 at 0x29c0: file ../src/dd.c, line 2380.
(gdb) run if=/dev/zero of=/dev/null
Starting program: /usr/bin/dd if=/dev/zero of=/dev/null
warning: Loadable section ".note.gnu.property" outside of ELF segments

Breakpoint 1, main (argc=3, argv=0x7fffffffd3b8) at ../src/dd.c:2380
2380    {
(gdb)  break mmap
Breakpoint 2 at 0x7ffff7ecd070: file ../sysdeps/unix/sysv/linux/mmap64.c, line 41.
(gdb) cont
Continuing.

Breakpoint 2, __GI___mmap64 (addr=addr@entry=0x0, len=len@entry=217742304, prot=prot@entry=1, flags=flags@entry=2, fd=fd@entry=3, 
    offset=offset@entry=0) at ../sysdeps/unix/sysv/linux/mmap64.c:41
41  {
(gdb) break munmap
Breakpoint 3 at 0x7ffff7ecd150: file ../sysdeps/unix/syscall-template.S, line 78.
(gdb) cont
Continuing.
^C
Program received signal SIGINT, Interrupt.
(gdb) info proc mappings
process 30592
Mapped address spaces:

          Start Addr           End Addr       Size     Offset objfile
      0x555555554000     0x555555556000     0x2000        0x0 /usr/bin/dd
      0x555555556000     0x555555562000     0xc000     0x2000 /usr/bin/dd
      0x555555562000     0x555555567000     0x5000     0xe000 /usr/bin/dd
      0x555555567000     0x555555568000     0x1000    0x12000 /usr/bin/dd
      0x555555568000     0x555555569000     0x1000    0x13000 /usr/bin/dd
      0x555555569000     0x55555558a000    0x21000        0x0 [heap]
      0x7fffeae2d000     0x7ffff7dd5000  0xcfa8000        0x0 /usr/lib/locale/locale-archive
...
(gdb) exit

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .