|
From: Lin Andy-A. <A2...@mo...> - 2007-11-15 07:20:59
|
Spacetime is not accurate sometime?
I wrote a test case as below.
If we used "malloc(100)" in line 9, the massif think that this line
occupied a large part of space time.=20
While we changed the line to malloc(1), the massif think malloc(64) in
line 4 occupied most of the spacetime.
In my view, malloc(100)'s life time is very short, so its spacetime
should be small, but it seems that malloc(100)'s life start time is
start after malloc(64)in line 4.Why is it designed as that? Anyone know
the reason?
1 int main(int argc, char *argv[])
2 {
3 char *pTest =3D NULL;
4 malloc(64);=20
5 =20
6 //sleep 10 second, in my view, malloc(64) will get a
large space*time.
7 sleep(10);
8 malloc(200);
9 pTest=3D (char *) malloc(100);
10 if(pTest !=3D NULL)
11 {
12 free(pTest);
13 }
14 printf("\nEnd\n");
15 }
=20
Thank you very much
Regards
Andy
|