How to see memory layout of my program in C during run-time?

后端 未结 3 1009
囚心锁ツ
囚心锁ツ 2020-12-13 15:56

I would like to see Memory layout of my program in C so that i can understand all the different segments of the Memory practically during run-time like change in BSS or Heap

3条回答
  •  一向
    一向 (楼主)
    2020-12-13 16:09

    Another alternative is pmap tool which dumps the process memory mapping details:

        pmap [ -x | -d ] [ -q ] pids...
        pmap -V
    

    pmap is part of procps collection.

    Also if you are interest in physical mapping, you can take a look at pagemap, which is made available in recent Linux Kernel to let process know it's physical memory info. It might be useful for user space driver development where user space process need to find physical address of a buffer as DMA destination.

    https://www.kernel.org/doc/Documentation/vm/pagemap.txt

提交回复
热议问题