(part 39) Han from China answers your C questions
- From: Nomen Nescio <nobody@xxxxxxxxx>
- Date: Sun, 23 Nov 2008 00:10:04 +0100 (CET)
Size of a process
mysorepushpa@xxxxxxxxx said:
Suppose I have a C program in which I would have done a couple of
mallocs which amounts upto 1MB. Assuming the size of the program is
around 100KB for other things like code, data and other stuff. Will
this malloc size be counted in the size of the program when the exe is
created for the program.
I would say no, since malloc() belongs to the DYNAMIC memory allocation
family, and memory allocated by malloc() doesn't usually account for
space in the binary file (nor does automatic storage for local variables
and such). On systems with the typical heap and stack mechanisms, space
is allocated and deallocated at run-time. However, the computing world
teaches us not to trust absolutes, so there may be some compiler or whatever
out there that preallocates a certain amount of space for dynamic allocation
requests.
Yours,
Han from China
All my posts will have subjects containing the words "Han from
China" or "Han from China's". This is so people can killfile me
easily if they wish. There are 3 posting IDs that my gateways
randomly assign me: George Orwell, Nomen Nescio, and Borked
Pseudo Mailed. You can killfile those too if you wish. Other
than that, my posts have a highly consistent format as well.
Thank you and good luck with your C programming.
.
- Follow-Ups:
- Re: (part 39) Han from China answers your C questions
- From: Chris M. Thomasson
- Re: (part 39) Han from China answers your C questions
- Prev by Date: Re: Dealing with "Han from China"
- Next by Date: Re: slurping in binary data
- Previous by thread: Announcement: New version of C-Code generator from UML state charts
- Next by thread: Re: (part 39) Han from China answers your C questions
- Index(es):
Relevant Pages
|