如何让一个程序的堆大小 [英] how to get Heap size of a program

查看:127
本文介绍了如何让一个程序的堆大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何找到linux平台下的C ++程序的堆内存的大小?我需要堆内存空间的新的或malloc和还使用前that.can有人帮忙照顾?

 的#include<&malloc.h所GT;
#包括LT&;&iostream的GT;
诠释的main()
{     //这里需要堆内存空间
     无符号字符* I2C_Read_Data =新unsigned char型[250];
     //获取堆内存空间的新用法之后
     返回0;
 }


解决方案

使用的valgrind的堆分析器:的地块

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?

#include <malloc.h>
#include <iostream>
int main()
{

     //here need heap memory space
     unsigned char* I2C_Read_Data= new unsigned char[250];
     //get heap memory space After the usage of new 
     return 0;
 }

解决方案

Use valgrind's heap profiler: Massif

这篇关于如何让一个程序的堆大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆