472,976 Members | 1,432 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,976 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 1632
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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.