how to get Heap size of a program

前端 未结 6 622
太阳男子
太阳男子 2020-12-18 23:07

How to find heap memory size of a c++ program under linux platform ?I need heap memory space before the usage of new or malloc and also after that.can anyone help?

6条回答
  •  情歌与酒
    2020-12-18 23:46

    You can try "mallinfo" and "malloc_info". They might work. mallinfo has issues when you allocate more than 2GB. malloc_info is o/s specific and notably very weird. I agree - very often it's nice to do this stuff without 3rd party tools.

提交回复
热议问题