如何在linux平台下找到c++程序的堆内存大小?在使用new或malloc之前以及在使用that.can之后,有人帮助我需要堆内存空间吗?
#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;
代码:
while(connectionOK) //connectionOK is the connection with server which might be forever
{
if(userlookup_IDNotFound(userID))
user_struct* newuser = malloc(getsize(user_struct));
setupUserAccount(newuser);
}
如果重要的话,我在ubuntu/ linux中使用了gcc。我知道像getrlimit这样的东西,但不确定它是否提供堆大小。尽管它确实给出了输入