468,512 Members | 1,429 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,512 developers. It's quick & easy.

How memory function free() knows how much memory to free.

Hi,

How does the memory management function 'free()' frees the memory
pointed by a pointer variable at run time. how does it know the size.
if there is way when free() can do, then why can't we do it
externally?.
Thanks
Panduranga Chary
Dec 27 '07 #1
2 4310

Hi,

How does the memory management function 'free()' frees the memory
pointed by a pointer variable at run time. how does it know the size.
if there is way when free() can do, then why can't we do it
externally?.
When you malloc memory, the size of the allocated block is stored somewhere.
What do you mean by externally?
Dec 27 '07 #2
Panduranga Chary <pr******@gmail.comwrites:
How does the memory management function 'free()' frees the memory
pointed by a pointer variable at run time. how does it know the size.
if there is way when free() can do, then why can't we do it
externally?.
The comp.lang.c FAQ is at <http://www.c-faq.com/>.
You've just asked question 7.26.

--
Keith Thompson (The_Other_Keith) <ks***@mib.org>
[...]
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Dec 27 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Chris S. | last post: by
9 posts views Thread by Mike P | last post: by
11 posts views Thread by Rodrigo Dominguez | last post: by
9 posts views Thread by Hemal | last post: by
9 posts views Thread by jeungster | last post: by
7 posts views Thread by siddhu | last post: by
34 posts views Thread by jacob navia | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.