answersLogoWhite

0


Best Answer

The memory is freed when the run-time library terminates. However, it is is bad form to not release memory when you are done with it, particularly as it is endemic to bad programming habits. Some things, like Operating System objects, can be leaked even when the program exits, so it is a good habit to always release what is allocated before program exit.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What if program terminates before releasing memory allocated by malloc?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What does gmon.out do in a program?

gmon.out is used by the GNU profiling tool (gprof). It is written in the program's working directory just before the program you are profiling terminates normally. If the program terminates abnormally (via a low-level _exit or an unhandled exception) the file is not written. The gprof syntax is: gprof options executable-file gmon.out bb-data [yet-more-profile-data-files...] [> outfile]


How do you end a program in c?

All C programs have a main() function, and when the end of that is reached, the program terminates, so to end a program, just type the ending curly bracket '}' to match the opening one of the main() function. It is considered good practice to end a program with the statement 'return 0;' before the last curly bracket, to indicate that the program terminated normally.


Why wont your c plus plus program stay open?

If you are talking about the program executing, but the output screen being displayed for a flash and then disappearing, I suggest adding getch() or getchar() function at the end of your main function. This will make sure that the output screen waits for you to press a character before the program terminates.


What are problem that can be arise when using allocating memory dynamic memory?

1. Using memory before/after the allocated area.2. Using the memory after deallocation.3. Forgetting deallocation.4. Multiple deallocation.5. Non-checking whether the allocation was succesfull or not.Not releasing dynamically allocated memory when it is no longer needed can cause the system to run out of mmory prematurely .this sometimes called a"memory leak"


What was the name of Photoshop before releasing it?

ImagePro


What 135353535 in repeating non terminating?

135353535 is a integer and it terminates before the decimal point (after 9 digits).


What is a hailstorm sequence in math?

A hailstorm sequence is when the sequence bounces around between numbers before it terminates.


How long do you keep a suppository in before releasing it?

hr


What strategy can a computer user employ to maximize the amount of CPU time allocated to the user's process at multi level queue scheduling?

The program could maximize the CPU time allocated to it by not fully utilizing its time quantums. It could use a large fraction of its assigned quantum, but relinquish the CPU before the end of the quantum, thereby increasing the priority associated with the process.


How do you put allocated in a sentence?

Have you allocated enough time to finish your homework before you go to the movie?


Static variable in c?

A static variable in C is one in which the memory is preallocated before the execution unit begins and lasts for the entire program unit.A non-static variable in C will be allocated in the block in which it is contained, and destroyed outside that block.


Is Stephenie Meyer releasing midnight sun the book before new moon the movie is released?

I don't think she is ever releasing Midnight Sun.