Operating System - HP-UX
1753395 Members
7250 Online
108792 Solutions
New Discussion

"free" syntax in C-language

 
Len Kiat Leong
Occasional Contributor

"free" syntax in C-language

I am using "malloc" syntax in C-language to allocate some buffer.

Then i used "free" syntax to release the buffer.

The problem is "free" does not work!! How do i know? I used "top" to monitor the size of my program and it keeps on growing!

Can anybody please advise me what's wrong with "free" syntax? It is a known problem?

I am using HP B180L workstation with HP-UX 10.20, ANSI C.
Nothing is permanent
1 REPLY 1
Andy Monks
Honored Contributor

Re: "free" syntax in C-language

The free() does release the memory. However, the virtual memory is still associated with the process.

Trust me the physical memory is released (although that too won't actually be really freed until something else wants it)