473,769 Members | 5,834 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[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_p trA[%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_p trA[%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_p trB[%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_p trB[%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_pt rA[0]
Tue Jul 4 07:01:25 CDT 2006 1679360 Rnd_0_new_up_pt rA[1]
Tue Jul 4 07:01:25 CDT 2006 1712128 Rnd_0_new_up_pt rA[2]
Tue Jul 4 07:01:25 CDT 2006 1744896 Rnd_0_new_up_pt rA[3]
Tue Jul 4 07:01:25 CDT 2006 1777664 Rnd_0_new_up_pt rA[4]
Tue Jul 4 07:01:25 CDT 2006 1810432 Rnd_0_new_up_pt rA[5]
Tue Jul 4 07:01:25 CDT 2006 1843200 Rnd_0_new_up_pt rA[6]
Tue Jul 4 07:01:25 CDT 2006 1875968 Rnd_0_new_up_pt rA[7]
Tue Jul 4 07:01:25 CDT 2006 1908736 Rnd_0_new_up_pt rA[8]
Tue Jul 4 07:01:25 CDT 2006 1941504 Rnd_0_new_up_pt rA[9]
Tue Jul 4 07:01:25 CDT 2006 1974272 Rnd_0_new_up_pt rA[10]
Tue Jul 4 07:01:25 CDT 2006 2007040 Rnd_0_new_up_pt rA[11]
Tue Jul 4 07:01:25 CDT 2006 2039808 Rnd_0_new_up_pt rA[12]
Tue Jul 4 07:01:26 CDT 2006 2072576 Rnd_0_new_up_pt rA[13]
Tue Jul 4 07:01:26 CDT 2006 2105344 Rnd_0_new_up_pt rA[14]
Tue Jul 4 07:01:26 CDT 2006 2138112 Rnd_0_new_up_pt rA[15]
Tue Jul 4 07:01:26 CDT 2006 2170880 Rnd_0_new_up_pt rA[16]
Tue Jul 4 07:01:26 CDT 2006 2203648 Rnd_0_new_up_pt rA[17]
Tue Jul 4 07:01:26 CDT 2006 2236416 Rnd_0_new_up_pt rA[18]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_new_up_pt rA[19]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_pt rA[19]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_pt rA[18]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_pt rA[17]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_pt rA[16]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_pt rA[15]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_pt rA[14]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_pt rA[13]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_pt rA[12]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[11]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[10]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[9]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[8]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[7]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[6]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[5]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[4]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[3]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[2]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[1]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[0]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_new_up_pt rB[0]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_new_up_pt rB[1]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_new_up_pt rB[2]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[3]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[4]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[5]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[6]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[7]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[8]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[9]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[10]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[11]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[12]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[13]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[14]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[15]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[16]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[17]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_new_up_pt rB[18]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_new_up_pt rB[19]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[19]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[18]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[17]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[16]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[15]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[14]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[13]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[12]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[11]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[10]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[9]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[8]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[7]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_pt rB[6]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_pt rB[5]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_pt rB[4]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_pt rB[3]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_pt rB[2]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_pt rB[1]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_pt rB[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 1670
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_p trA[%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_p trA[%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_p trB[%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_p trB[%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_pt rA[0]
Tue Jul 4 07:01:25 CDT 2006 1679360 Rnd_0_new_up_pt rA[1]
Tue Jul 4 07:01:25 CDT 2006 1712128 Rnd_0_new_up_pt rA[2]
Tue Jul 4 07:01:25 CDT 2006 1744896 Rnd_0_new_up_pt rA[3]
Tue Jul 4 07:01:25 CDT 2006 1777664 Rnd_0_new_up_pt rA[4]
Tue Jul 4 07:01:25 CDT 2006 1810432 Rnd_0_new_up_pt rA[5]
Tue Jul 4 07:01:25 CDT 2006 1843200 Rnd_0_new_up_pt rA[6]
Tue Jul 4 07:01:25 CDT 2006 1875968 Rnd_0_new_up_pt rA[7]
Tue Jul 4 07:01:25 CDT 2006 1908736 Rnd_0_new_up_pt rA[8]
Tue Jul 4 07:01:25 CDT 2006 1941504 Rnd_0_new_up_pt rA[9]
Tue Jul 4 07:01:25 CDT 2006 1974272 Rnd_0_new_up_pt rA[10]
Tue Jul 4 07:01:25 CDT 2006 2007040 Rnd_0_new_up_pt rA[11]
Tue Jul 4 07:01:25 CDT 2006 2039808 Rnd_0_new_up_pt rA[12]
Tue Jul 4 07:01:26 CDT 2006 2072576 Rnd_0_new_up_pt rA[13]
Tue Jul 4 07:01:26 CDT 2006 2105344 Rnd_0_new_up_pt rA[14]
Tue Jul 4 07:01:26 CDT 2006 2138112 Rnd_0_new_up_pt rA[15]
Tue Jul 4 07:01:26 CDT 2006 2170880 Rnd_0_new_up_pt rA[16]
Tue Jul 4 07:01:26 CDT 2006 2203648 Rnd_0_new_up_pt rA[17]
Tue Jul 4 07:01:26 CDT 2006 2236416 Rnd_0_new_up_pt rA[18]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_new_up_pt rA[19]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_pt rA[19]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_pt rA[18]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_pt rA[17]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_pt rA[16]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_pt rA[15]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_pt rA[14]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_pt rA[13]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_pt rA[12]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[11]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[10]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[9]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[8]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[7]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[6]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[5]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[4]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[3]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[2]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[1]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[0]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_new_up_pt rB[0]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_new_up_pt rB[1]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_new_up_pt rB[2]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[3]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[4]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[5]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[6]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[7]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[8]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[9]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[10]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[11]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[12]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[13]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[14]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[15]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[16]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[17]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_new_up_pt rB[18]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_new_up_pt rB[19]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[19]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[18]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[17]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[16]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[15]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[14]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[13]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[12]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[11]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[10]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[9]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[8]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[7]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_pt rB[6]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_pt rB[5]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_pt rB[4]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_pt rB[3]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_pt rB[2]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_pt rB[1]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_pt rB[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.progr ammer.
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.progr ammer.
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_p trA[%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_p trA[%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_p trB[%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_p trB[%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_pt rA[0]
Tue Jul 4 07:01:25 CDT 2006 1679360 Rnd_0_new_up_pt rA[1]
Tue Jul 4 07:01:25 CDT 2006 1712128 Rnd_0_new_up_pt rA[2]
Tue Jul 4 07:01:25 CDT 2006 1744896 Rnd_0_new_up_pt rA[3]
Tue Jul 4 07:01:25 CDT 2006 1777664 Rnd_0_new_up_pt rA[4]
Tue Jul 4 07:01:25 CDT 2006 1810432 Rnd_0_new_up_pt rA[5]
Tue Jul 4 07:01:25 CDT 2006 1843200 Rnd_0_new_up_pt rA[6]
Tue Jul 4 07:01:25 CDT 2006 1875968 Rnd_0_new_up_pt rA[7]
Tue Jul 4 07:01:25 CDT 2006 1908736 Rnd_0_new_up_pt rA[8]
Tue Jul 4 07:01:25 CDT 2006 1941504 Rnd_0_new_up_pt rA[9]
Tue Jul 4 07:01:25 CDT 2006 1974272 Rnd_0_new_up_pt rA[10]
Tue Jul 4 07:01:25 CDT 2006 2007040 Rnd_0_new_up_pt rA[11]
Tue Jul 4 07:01:25 CDT 2006 2039808 Rnd_0_new_up_pt rA[12]
Tue Jul 4 07:01:26 CDT 2006 2072576 Rnd_0_new_up_pt rA[13]
Tue Jul 4 07:01:26 CDT 2006 2105344 Rnd_0_new_up_pt rA[14]
Tue Jul 4 07:01:26 CDT 2006 2138112 Rnd_0_new_up_pt rA[15]
Tue Jul 4 07:01:26 CDT 2006 2170880 Rnd_0_new_up_pt rA[16]
Tue Jul 4 07:01:26 CDT 2006 2203648 Rnd_0_new_up_pt rA[17]
Tue Jul 4 07:01:26 CDT 2006 2236416 Rnd_0_new_up_pt rA[18]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_new_up_pt rA[19]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_pt rA[19]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_pt rA[18]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_pt rA[17]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_pt rA[16]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_pt rA[15]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_pt rA[14]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_pt rA[13]
Tue Jul 4 07:01:26 CDT 2006 2269184 Rnd_0_delete_pt rA[12]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[11]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[10]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[9]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[8]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[7]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[6]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[5]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[4]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[3]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[2]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[1]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_delete_pt rA[0]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_new_up_pt rB[0]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_new_up_pt rB[1]
Tue Jul 4 07:01:27 CDT 2006 2269184 Rnd_0_new_up_pt rB[2]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[3]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[4]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[5]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[6]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[7]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[8]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[9]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[10]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[11]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[12]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[13]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[14]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[15]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[16]
Tue Jul 4 07:01:28 CDT 2006 2269184 Rnd_0_new_up_pt rB[17]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_new_up_pt rB[18]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_new_up_pt rB[19]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[19]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[18]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[17]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[16]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[15]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[14]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[13]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[12]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[11]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[10]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[9]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[8]
Tue Jul 4 07:01:29 CDT 2006 2269184 Rnd_0_delete_pt rB[7]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_pt rB[6]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_pt rB[5]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_pt rB[4]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_pt rB[3]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_pt rB[2]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_pt rB[1]
Tue Jul 4 07:01:30 CDT 2006 2269184 Rnd_0_delete_pt rB[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_p trA[%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_p trA[%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
1364
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 the object should also know that the object is blocked. Any ideas??! halp!! take care everyone,
2
1873
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 fileObject.readline() then it halts the program if the sub-process is waiting for user input; will executing the readline() part in a seperate thread be helpful? My target platform is Windows. Links to helpful web resources and sample Python codes...
8
5480
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 -------------------------------------------------------------------------------- Hello, I have a very simple problem but cannot seem to figure it out. I have a very simple php script that sends a test email to myself. When I debug it in PHP designer, it works with no problems, I get the test email. If
6
2881
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 suggestion for improvements or conversion to iteration would be much appreciated
6
4076
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 ..../adm_std_mo_descr.h:244: warning: non-static const member `const char *const std_mo::name' in class without a constructor The header file looks as the following: typedef struct std_tee {
3
9736
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 at the machine to cancel the process cleanly if he/she needs to. In Unix this would be a tiny shell script that used "kill -15", but under Windows there does not seem to be an easy way to do this, at least that I can find. Below is a test...
9
2932
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 pipe writers/readers and figure out what data had flowed. Here is my application (and I'd be grateful for any other advice). I'm incorporating cryptographic FOBs into my PHP-based database application to enhance login security.
4
1695
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 if (arg.equals(" Help Page")) { } else if (arg.equals("BrowserControl")) {
8
3173
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 The Data Segment : at the start it's size is small but as the process goes on and requires Dynamic Memory allocation, its size increases.
0
9579
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10199
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10032
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9979
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9849
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8861
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7393
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5293
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5433
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.