Heap and pmap ....

4 views
Skip to first unread message

Truong

unread,
Feb 15, 2010, 5:46:41 PM2/15/10
to cs644s10_umb
Hi Professor.

Here is one of the run of my program in question 4, hw1:

windy@sf06:~/cs644/hw1$ ./memtest 10000&
[1] 27841
windy@sf06:~/cs644/hw1$ pmap 27841
27841: ./memtest 10000
0000000000400000 4K r-x-- /courses/cs644/s10/eoneil/windy/hw1/
memtest
0000000000600000 4K r---- /courses/cs644/s10/eoneil/windy/hw1/
memtest
0000000000601000 4K rw--- /courses/cs644/s10/eoneil/windy/hw1/
memtest
00007fba293c7000 1851396K rw--- [ anon ]
00007fba9a3c8000 1444K r-x-- /lib/libc-2.8.90.so
00007fba9a531000 2044K ----- /lib/libc-2.8.90.so
00007fba9a730000 16K r---- /lib/libc-2.8.90.so
00007fba9a734000 4K rw--- /lib/libc-2.8.90.so
00007fba9a735000 20K rw--- [ anon ]
00007fba9a73a000 124K r-x-- /lib/ld-2.8.90.so
00007fba9a94b000 8K rw--- [ anon ]
00007fba9a955000 12K rw--- [ anon ]
00007fba9a958000 4K r---- /lib/ld-2.8.90.so
00007fba9a959000 4K rw--- /lib/ld-2.8.90.so
00007fffa2944000 84K rw--- [ stack ]
00007fffa29fe000 4K r-x-- [ anon ]
ffffffffff600000 4K r-x-- [ anon ]
total 1855180K

I asked for 10, 000 MBytes, but the heap only showed less than
2MBytes. Why? I tried with smaller amount, such as 1234 MBytes and it
seemed to show the map reasonably close to the amount asked. What
actually happened? You can look at the code in memtest.c at ~windy/
cs644/hw1.
Thank you.


Truong.

Betty O'Neil

unread,
Feb 15, 2010, 8:24:49 PM2/15/10
to cs644s10_umb
Did you use a numeric type big enough to hold 10GB? Note that
2GB is the max for a signed int.--Betty O.

Truong

unread,
Feb 15, 2010, 11:11:28 PM2/15/10
to cs644s10_umb
I didn't use var to hold the whole numer of MB. I defined a symbol MB
as 1048576 instead. This times the number entered by user gives the
number of MBs needed, as

int num = atoi(argv[1]);
char *mem = malloc(MB*num*sizeof(char));

what is wrong here?

On Feb 15, 8:24 pm, "Betty O'Neil" <eon...@cs.umb.edu> wrote:
> Did you use a numeric type big enough to hold 10GB? Note that
> 2GB is the max for a signed int.--Betty O.
>
>
>
> On Mon, 15 Feb 2010, Truong wrote:
> > Hi Professor.
>
> > Here is one of the run of my program in question 4, hw1:
>
> > windy@sf06:~/cs644/hw1$ ./memtest 10000&
> > [1] 27841
> > windy@sf06:~/cs644/hw1$ pmap 27841
> > 27841:   ./memtest 10000
> > 0000000000400000      4K r-x--  /courses/cs644/s10/eoneil/windy/hw1/
> > memtest
> > 0000000000600000      4K r----  /courses/cs644/s10/eoneil/windy/hw1/
> > memtest
> > 0000000000601000      4K rw---  /courses/cs644/s10/eoneil/windy/hw1/
> > memtest

> > 00007fba293c70001851396K rw---    [ anon ]

Reply all
Reply to author
Forward
0 new messages