Prepare for your Next Interview
|
Welcome to the Geeks Talk forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
This is a discussion on Deallocating dynamically allocated heap within the C and C++ forums, part of the Software Development category; When i am dynamically allocating memory (heap) in a program, and in this case if i am not making an explicit deallocation call or free() call then when will this ...
|
|||||||
|
|||
|
Deallocating dynamically allocated heap
When i am dynamically allocating memory (heap) in a program, and in this case if i am not making an explicit deallocation call or free() call then when will this dynamicaaly allocated heap will get deallocated.Is it at the end of program or is it at the end of c session or is it when i shut down my system.
NOTE : [This question was asked by Leomachy] |
| The Following User Says Thank You to JobHelper For This Useful Post: | ||
| Sponsored Links |
|
|||
|
Re: Deallocating dynamically allocated heap
i think you get solution by follow the following steps:
-->write some C, c++ any code which will alocate some memory. -->note down the address where you are allocating the memory. -->Now meanwhile write and open another C program, which will display the content of memory that you are allocating previously. -->for the first program ,,,end the session and check in the second C program. --> |
|
|||
|
Re: Deallocating dynamically allocated heap
i think you get solution by follow the following steps:
-->write some C, c++ any code which will alocate some memory. -->note down the address where you are allocating the memory. -->Now meanwhile write and open another C program, which will display the content of memory that you are allocating previously. -->for the first program ,,,end the session and check in the second C program. --> same way quit from the application and check in the second C program memory content. .................... --> |
|
|||
|
Re: Deallocating dynamically allocated heap
Quote:
When a malloc() is called some physical memory is mapped on to your process address space. When your process will ends up this memory will return to the system. |
|
|||
|
Re: Deallocating dynamically allocated heap
The allocated memory will last till you process ends. But this is not a good practice, u shuld deallocate the memory what u allocate else it can cause memory leak and your system will crash
|
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to check planidrome dynamically? | JobHelper | C and C++ | 1 | 07-27-2007 01:47 AM |
| Dynamically pass parameter file in 8.1.1 | JobHelper | Data Warehousing | 0 | 12-24-2006 06:30 AM |