Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > How memory function free() knows how much memory to free.

Reply
Thread Tools

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

 
 
Panduranga Chary
Guest
Posts: n/a
 
      12-27-2007
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
 
Reply With Quote
 
 
 
 
MisterE
Guest
Posts: n/a
 
      12-27-2007


> 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?


 
Reply With Quote
 
 
 
 
Keith Thompson
Guest
Posts: n/a
 
      12-27-2007
Panduranga Chary <(E-Mail Removed)> writes:
> 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) <(E-Mail Removed)>
[...]
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
DVD Soon or much much later? anthony DVD Video 10 07-08-2005 07:13 PM
Simulation questions...how much is too much? =?Utf-8?B?VGlwcHk=?= Microsoft Certification 0 04-16-2005 04:47 AM
CPU Heat--how much is too much? PowerPost2000 Computer Support 4 12-22-2003 12:40 AM
paranoia... much too much adcl Computer Support 14 11-08-2003 05:18 PM



Advertisments