用free -h檢視記憶體使用變化
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
void realseSt(char *tmpSt)
{
sleep(3);
if(NULL != tmpSt)
{
free(tmpSt);
// tmpSt = NULL;
}
}
int main ()
{
char *st = NULL;
sleep(3);
st = (char*)malloc(1024*1024*1024);//byte
memset(st,0,1024*1024*1024);
realseSt(st);
printf("------test--------\n");
while(1);
}