- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How does free() know the size of memory to be deallocated?
45 Lectures 4.5 hours
66 Lectures 5.5 hours
The free() function is used to deallocate memory while it is allocated using malloc(), calloc() and realloc(). The syntax of the free is simple. We simply use free with the pointer. Then it can clean up the memory.
The free() is not taking any size as parameter, but only pointer. So the question comes, that how the free() function know about the size of the block to deallocate?
When we use the dynamic memory allocation techniques for memory allocations, then this is done in the actual heap section. It creates one word larger than the requested size. This extra word is used to store the size. This size is used by free() when it wants to clear the memory space.
- How to get free size of internal/external memory in Android App?
- How to get free size of internal/external memory in Android App using Kotlin?
- How does delete “know” the size of the operand array in C++
- Display the amount of free memory in the Java Virtual Machine
- Know about YouTube and How to find Free Movies on YouTube?
- How to find current size (in memory) of table in MySQL?
- How to retrieve the Azure VM deallocated date using PowerShell?
- How much size does the VARCHAR takes- the defined size or the size of the content in SAP HANA?
- Getting size in memory of an object in PHP?
- How does a process look like in memory?
- Know what Ad Size is Optimum for your Website?
- How and where does String literals in Java stored in the memory?
- What does the method size() do in java?
- How can scikit-learn package be used to transform an array of specific size to a different size?