473,396 Members | 1,975 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

[HELP] Application Process Size in UNIX Enironment

Hi folks,
Recently, I am investigatin a memory leak issue.
I have written a simple C++ program and a Perl script to test on UNIX
environment machine.
I do a for loop to new up 20 char of size 32768 bytes, then delete
them. Please see below:

//// part of the code start ////
for (i=0; i<20; i++) {
ptrA[i] = new (std::nothrow) char[32768];
if (ptrA[i] == 0)
return 1;
//chk size here
sprintf (strCmd, "perl csize.pl Rnd_%d_new_up_ptrA[%d]
%d",j, i, pid);
system(strCmd);
}
for (i=19; i>=0; i--) {
delete ptrA[i];
ptrA[i] = NULL;
//chk size here
sprintf (strCmd, "perl csize.pl Rnd_%d_delete_ptrA[%d]
%d",j, i, pid);
system(strCmd);
}
for (i=0; i<20; i++) {
ptrB[i] = new (std::nothrow) int(1863);
if (ptrB[i] == 0)
return 1;
//chk size here
sprintf (strCmd, "perl csize.pl Rnd_%d_new_up_ptrB[%d]
%d",j, i, pid);
system(strCmd);
}
for (i=19; i>=0; i--) {
delete ptrB[i];
ptrB[i] = 0;
//chk size here
sprintf (strCmd, "perl csize.pl Rnd_%d_delete_ptrB[%d]
%d",j, i, pid);
system(strCmd);
}
//// part of the code end ////

And, following is my log been captured:
Tue Jul 4 07:01:25 CDT 2006 1613824 prog_init
Tue Jul 4 07:01:25 CDT 2006 1646592 Rnd_0_new_up_ptrA[0]
Tue Jul 4 07:01:25 CDT 2006 1679360 Rnd_0_new_up_ptrA[1]
Tue Jul 4 07:01:25 CDT 2006 1712128 Rnd_0_new_up_ptrA[2]
Tue Jul 4 07:01:25 CDT 2006 1744896 Rnd_0_new_up_ptrA[3]
Tue Jul 4 07:01:25 CDT 2006 1777664 Rnd_0_new_up_ptrA[4]
Tue Jul 4 07:01:25 CDT 2006 1810432 Rnd_0_new_up_ptrA[5]
Tue Jul 4 07:01:25 CDT 2006 1843200 Rnd_0_new_up_ptrA[6]
Tue Jul 4 07:01:25 CDT 2006 1875968 Rnd_0_new_up_ptrA[7]
Tue Jul 4 07:01:25 CDT 2006 1908736 Rnd_0_new_up_ptrA[8]
Tue Jul 4 07:01:25 CDT 2006 1941504 Rnd_0_new_up_ptrA[9]
Tue Jul 4 07:01:25 CDT 2006 1974272 Rnd_0_new_up_ptrA[10]
Tue Jul 4 07:01:25 CDT 2006 2007040 Rnd_0_new_up_ptrA[11]
Tue Jul 4 07:01:25 CDT 2006 2039808 Rnd_0_new_up_ptrA[12]
Tue Jul 4 07:01:26 CDT 2006 2072576 Rnd_0_new_up_ptrA[13]
Tue Jul 4 07:01:26 CDT 2006 2105344 Rnd_0_new_up_ptrA[14]
Tue Jul 4 07:01:26 CDT 2006 2138112 Rnd_0_new_up_ptrA[15]
Tue Jul 4 07:01:26 CDT 2006 2170880 Rnd_0_new_up_ptrA[16]
Tue Jul 4 07:01:26 CDT 2006 2203648 Rnd_0_new_up_ptrA[17]
Tue Jul 4 07:01:26 CDT 2006 2236416 Rnd_0_new_up_ptrA[18]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_new_up_ptrA[19]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_ptrA[19]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_ptrA[18]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_ptrA[17]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_ptrA[16]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_ptrA[15]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_ptrA[14]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_ptrA[13]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_ptrA[12]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[11]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[10]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[9]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[8]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[7]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[6]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[5]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[4]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[3]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[2]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[1]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[0]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_new_up_ptrB[0]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_new_up_ptrB[1]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_new_up_ptrB[2]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[3]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[4]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[5]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[6]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[7]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[8]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[9]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[10]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[11]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[12]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[13]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[14]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[15]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[16]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[17]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_new_up_ptrB[18]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_new_up_ptrB[19]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[19]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[18]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[17]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[16]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[15]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[14]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[13]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[12]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[11]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[10]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[9]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[8]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[7]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_ptrB[6]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_ptrB[5]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_ptrB[4]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_ptrB[3]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_ptrB[2]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_ptrB[1]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_ptrB[0]
I noticed that the process size only increase for the first 20 new-ups
for ptrA though I loop it for a few rounds.
Then, come to delete, the process size never decreased.
After that, for newing-up ptrB, there is no increasing for process size
also (is this normal?).
Finally, delete ptrB still maintain the process size without
decreasing.

I have 2 question here:
a) When 'delete' a new-up pointer in UNIX environment, the process size
will not be decreased?
b) From my log, why when newing-up my ptrB, there is no increasing
size?

Hope you guys understand my problem. Looking for UNIX or Memory expert
to kill my doubts.
Thanks.

regards,
Vynce

Jul 5 '06 #1
6 1648
asimorio wrote:
Hi folks,
Recently, I am investigatin a memory leak issue.
I have written a simple C++ program and a Perl script to test on UNIX
environment machine.
I do a for loop to new up 20 char of size 32768 bytes, then delete
them. Please see below:

//// part of the code start ////
for (i=0; i<20; i++) {
ptrA[i] = new (std::nothrow) char[32768];
if (ptrA[i] == 0)
return 1;
//chk size here
sprintf (strCmd, "perl csize.pl Rnd_%d_new_up_ptrA[%d]
%d",j, i, pid);
system(strCmd);
}
for (i=19; i>=0; i--) {
delete ptrA[i];
ptrA[i] = NULL;
//chk size here
sprintf (strCmd, "perl csize.pl Rnd_%d_delete_ptrA[%d]
%d",j, i, pid);
system(strCmd);
}
for (i=0; i<20; i++) {
ptrB[i] = new (std::nothrow) int(1863);
if (ptrB[i] == 0)
return 1;
//chk size here
sprintf (strCmd, "perl csize.pl Rnd_%d_new_up_ptrB[%d]
%d",j, i, pid);
system(strCmd);
}
for (i=19; i>=0; i--) {
delete ptrB[i];
ptrB[i] = 0;
//chk size here
sprintf (strCmd, "perl csize.pl Rnd_%d_delete_ptrB[%d]
%d",j, i, pid);
system(strCmd);
}
//// part of the code end ////

And, following is my log been captured:
Tue Jul 4 07:01:25 CDT 2006 1613824 prog_init
Tue Jul 4 07:01:25 CDT 2006 1646592 Rnd_0_new_up_ptrA[0]
Tue Jul 4 07:01:25 CDT 2006 1679360 Rnd_0_new_up_ptrA[1]
Tue Jul 4 07:01:25 CDT 2006 1712128 Rnd_0_new_up_ptrA[2]
Tue Jul 4 07:01:25 CDT 2006 1744896 Rnd_0_new_up_ptrA[3]
Tue Jul 4 07:01:25 CDT 2006 1777664 Rnd_0_new_up_ptrA[4]
Tue Jul 4 07:01:25 CDT 2006 1810432 Rnd_0_new_up_ptrA[5]
Tue Jul 4 07:01:25 CDT 2006 1843200 Rnd_0_new_up_ptrA[6]
Tue Jul 4 07:01:25 CDT 2006 1875968 Rnd_0_new_up_ptrA[7]
Tue Jul 4 07:01:25 CDT 2006 1908736 Rnd_0_new_up_ptrA[8]
Tue Jul 4 07:01:25 CDT 2006 1941504 Rnd_0_new_up_ptrA[9]
Tue Jul 4 07:01:25 CDT 2006 1974272 Rnd_0_new_up_ptrA[10]
Tue Jul 4 07:01:25 CDT 2006 2007040 Rnd_0_new_up_ptrA[11]
Tue Jul 4 07:01:25 CDT 2006 2039808 Rnd_0_new_up_ptrA[12]
Tue Jul 4 07:01:26 CDT 2006 2072576 Rnd_0_new_up_ptrA[13]
Tue Jul 4 07:01:26 CDT 2006 2105344 Rnd_0_new_up_ptrA[14]
Tue Jul 4 07:01:26 CDT 2006 2138112 Rnd_0_new_up_ptrA[15]
Tue Jul 4 07:01:26 CDT 2006 2170880 Rnd_0_new_up_ptrA[16]
Tue Jul 4 07:01:26 CDT 2006 2203648 Rnd_0_new_up_ptrA[17]
Tue Jul 4 07:01:26 CDT 2006 2236416 Rnd_0_new_up_ptrA[18]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_new_up_ptrA[19]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_ptrA[19]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_ptrA[18]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_ptrA[17]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_ptrA[16]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_ptrA[15]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_ptrA[14]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_ptrA[13]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_ptrA[12]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[11]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[10]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[9]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[8]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[7]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[6]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[5]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[4]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[3]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[2]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[1]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[0]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_new_up_ptrB[0]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_new_up_ptrB[1]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_new_up_ptrB[2]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[3]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[4]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[5]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[6]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[7]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[8]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[9]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[10]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[11]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[12]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[13]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[14]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[15]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[16]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[17]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_new_up_ptrB[18]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_new_up_ptrB[19]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[19]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[18]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[17]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[16]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[15]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[14]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[13]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[12]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[11]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[10]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[9]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[8]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[7]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_ptrB[6]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_ptrB[5]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_ptrB[4]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_ptrB[3]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_ptrB[2]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_ptrB[1]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_ptrB[0]
I noticed that the process size only increase for the first 20 new-ups
for ptrA though I loop it for a few rounds.
Then, come to delete, the process size never decreased.
After that, for newing-up ptrB, there is no increasing for process size
also (is this normal?).
Finally, delete ptrB still maintain the process size without
decreasing.

I have 2 question here:
a) When 'delete' a new-up pointer in UNIX environment, the process size
will not be decreased?
b) From my log, why when newing-up my ptrB, there is no increasing
size?

Hope you guys understand my problem. Looking for UNIX or Memory expert
to kill my doubts.
Thanks.

regards,
Vynce
Well, the deleted memory is still in your app's process space (in the
free-list) and will be reused to satisfy later allocations. Only when
the app terminates will the memory be returned to the OS.

Larry
Jul 5 '06 #2
asimorio wrote:

Stuff that should go to comp.unix.programmer.
I noticed that the process size only increase for the first 20 new-ups
for ptrA though I loop it for a few rounds.
Then, come to delete, the process size never decreased.
After that, for newing-up ptrB, there is no increasing for process size
also (is this normal?).
Yes - repost to the above group for more comprehensive answers. If that
group had an FAQ - this would be on it!

--
Ian Collins.
Jul 5 '06 #3
Thanks Collins.
I will try to re-post to that group.

Ian Collins wrote:
asimorio wrote:

Stuff that should go to comp.unix.programmer.
I noticed that the process size only increase for the first 20 new-ups
for ptrA though I loop it for a few rounds.
Then, come to delete, the process size never decreased.
After that, for newing-up ptrB, there is no increasing for process size
also (is this normal?).

Yes - repost to the above group for more comprehensive answers. If that
group had an FAQ - this would be on it!

--
Ian Collins.
Jul 5 '06 #4
Hi Larry,
do you have any documentation or website that showing the "re-use"
thing by UNIX?
thanks.
Larry I Smith wrote:
>
Well, the deleted memory is still in your app's process space (in the
free-list) and will be reused to satisfy later allocations. Only when
the app terminates will the memory be returned to the OS.

Larry
Jul 5 '06 #5
asimorio wrote:
Hi folks,
Recently, I am investigatin a memory leak issue.
I have written a simple C++ program and a Perl script to test on UNIX
environment machine.
I do a for loop to new up 20 char of size 32768 bytes, then delete
them. Please see below:

//// part of the code start ////
for (i=0; i<20; i++) {
ptrA[i] = new (std::nothrow) char[32768];
if (ptrA[i] == 0)
return 1;
//chk size here
sprintf (strCmd, "perl csize.pl Rnd_%d_new_up_ptrA[%d]
%d",j, i, pid);
system(strCmd);
}
for (i=19; i>=0; i--) {
delete ptrA[i];
ptrA[i] = NULL;
//chk size here
sprintf (strCmd, "perl csize.pl Rnd_%d_delete_ptrA[%d]
%d",j, i, pid);
system(strCmd);
}
for (i=0; i<20; i++) {
ptrB[i] = new (std::nothrow) int(1863);
if (ptrB[i] == 0)
return 1;
//chk size here
sprintf (strCmd, "perl csize.pl Rnd_%d_new_up_ptrB[%d]
%d",j, i, pid);
system(strCmd);
}
for (i=19; i>=0; i--) {
delete ptrB[i];
ptrB[i] = 0;
//chk size here
sprintf (strCmd, "perl csize.pl Rnd_%d_delete_ptrB[%d]
%d",j, i, pid);
system(strCmd);
}
//// part of the code end ////

And, following is my log been captured:
Tue Jul 4 07:01:25 CDT 2006 1613824 prog_init
Tue Jul 4 07:01:25 CDT 2006 1646592 Rnd_0_new_up_ptrA[0]
Tue Jul 4 07:01:25 CDT 2006 1679360 Rnd_0_new_up_ptrA[1]
Tue Jul 4 07:01:25 CDT 2006 1712128 Rnd_0_new_up_ptrA[2]
Tue Jul 4 07:01:25 CDT 2006 1744896 Rnd_0_new_up_ptrA[3]
Tue Jul 4 07:01:25 CDT 2006 1777664 Rnd_0_new_up_ptrA[4]
Tue Jul 4 07:01:25 CDT 2006 1810432 Rnd_0_new_up_ptrA[5]
Tue Jul 4 07:01:25 CDT 2006 1843200 Rnd_0_new_up_ptrA[6]
Tue Jul 4 07:01:25 CDT 2006 1875968 Rnd_0_new_up_ptrA[7]
Tue Jul 4 07:01:25 CDT 2006 1908736 Rnd_0_new_up_ptrA[8]
Tue Jul 4 07:01:25 CDT 2006 1941504 Rnd_0_new_up_ptrA[9]
Tue Jul 4 07:01:25 CDT 2006 1974272 Rnd_0_new_up_ptrA[10]
Tue Jul 4 07:01:25 CDT 2006 2007040 Rnd_0_new_up_ptrA[11]
Tue Jul 4 07:01:25 CDT 2006 2039808 Rnd_0_new_up_ptrA[12]
Tue Jul 4 07:01:26 CDT 2006 2072576 Rnd_0_new_up_ptrA[13]
Tue Jul 4 07:01:26 CDT 2006 2105344 Rnd_0_new_up_ptrA[14]
Tue Jul 4 07:01:26 CDT 2006 2138112 Rnd_0_new_up_ptrA[15]
Tue Jul 4 07:01:26 CDT 2006 2170880 Rnd_0_new_up_ptrA[16]
Tue Jul 4 07:01:26 CDT 2006 2203648 Rnd_0_new_up_ptrA[17]
Tue Jul 4 07:01:26 CDT 2006 2236416 Rnd_0_new_up_ptrA[18]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_new_up_ptrA[19]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_ptrA[19]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_ptrA[18]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_ptrA[17]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_ptrA[16]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_ptrA[15]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_ptrA[14]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_ptrA[13]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_ptrA[12]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[11]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[10]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[9]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[8]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[7]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[6]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[5]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[4]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[3]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[2]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[1]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_ptrA[0]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_new_up_ptrB[0]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_new_up_ptrB[1]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_new_up_ptrB[2]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[3]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[4]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[5]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[6]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[7]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[8]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[9]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[10]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[11]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[12]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[13]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[14]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[15]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[16]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_ptrB[17]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_new_up_ptrB[18]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_new_up_ptrB[19]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[19]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[18]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[17]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[16]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[15]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[14]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[13]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[12]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[11]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[10]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[9]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[8]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_ptrB[7]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_ptrB[6]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_ptrB[5]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_ptrB[4]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_ptrB[3]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_ptrB[2]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_ptrB[1]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_ptrB[0]
I noticed that the process size only increase for the first 20 new-ups
for ptrA though I loop it for a few rounds.
Then, come to delete, the process size never decreased.
After that, for newing-up ptrB, there is no increasing for process size
also (is this normal?).
Finally, delete ptrB still maintain the process size without
decreasing.

I have 2 question here:
a) When 'delete' a new-up pointer in UNIX environment, the process size
will not be decreased?
That is up to the implementation. A C++ compiler is free to generate code
for new and delete that keep memory around for reuse by the program. There
is no requirement that memory be returned to the OS.

Sometimes, an implementation makes such decisions based upon the size of the
memory chunks you allocate. Try allocating chunks of size 200000 and see
what happens.
b) From my log, why when newing-up my ptrB, there is no increasing
size?
That is because you called delete before. The memory is being reused.

Best

Kai-Uwe Bux
Jul 5 '06 #6
Just curious
Should <<<----------------------------------------------- this line not
be

delete []ptrA[i];

//// part of the code start ////
for (i=0; i<20; i++) {
ptrA[i] = new (std::nothrow) char[32768];
if (ptrA[i] == 0)
return 1;
//chk size here
sprintf (strCmd, "perl csize.pl Rnd_%d_new_up_ptrA[%d]
%d",j, i, pid);
system(strCmd);
}
for (i=19; i>=0; i--) {
delete ptrA[i]; //
<<<-----------------------------------------------
ptrA[i] = NULL;
//chk size here
sprintf (strCmd, "perl csize.pl Rnd_%d_delete_ptrA[%d]
%d",j, i, pid);
system(strCmd);
}
same for ptrB

Jul 5 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Donny | last post by:
We have an object that is to be shared across different multi-threaded nodes in a distributed system. It should be possible to lock that object using any thread, and the other node which shares...
2
by: Apple Grew | last post by:
I want to develope a Winboard like application which will support Winboard protocol. For that I require to know how to handle piping in Python. I seperated out module popen2, but when I use...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
6
by: Jamal | last post by:
I am working on binary files of struct ACTIONS I have a recursive qsort/mergesort hybrid that 1) i'm not a 100% sure works correctly 2) would like to convert to iteration Any comments or...
6
by: zhixin_han | last post by:
Following warnings are found in my application: ..../adm_std_mo_descr.h:240: warning: non-static const member `const struct std_tee_t std_mo::tee' in class without a constructor...
3
by: Daniel Clark | last post by:
I have a Windows command line based application that only shuts down cleanly if it sees "CTRL-C" on the console. I need to automate the running of this application, but still allow the user sitting...
9
by: David T. Ashley | last post by:
Thanks for the helpful replies on the other thread. Essentially it was pointed out that a process with the same UID as the ones writing/reading the pipes would be able to examine the memory of the...
4
by: Guern1 | last post by:
Hi Need a bit of help here please to point me in the right direction. I have a java class file here which i wish from a menu item to open a web page which contains a help page. ] } else...
8
by: Nehil | last post by:
When a process is started three segments are created : 1) Text. 2) Stack. 3) Data. The size of First two is fixed and their upperlimit is fixed by the compiler. (Plz correct if i'm wrong) Now...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.