0

I'm thinking about the problem that if I allocate a block of memory to a program while without free it before the program ends. The memory whether can be reallocated? or do I have any ways to free that leaked memory so that it can be used again? Does C or C++ support the free function automatically?

Yongy-vers
  • 13
  • 3
  • 2
    When the program ends, all the memory is reclaimed by the operating system. – Eljay Apr 28 '21 at 12:37
  • Stop thinking and test it:) write a short app that allocates a meg and does not free it. Run it continually from a batch file loop. Leave it all running over a weekend. On Monday, inspect your system to see if anything notable has happened. – Martin James Apr 28 '21 at 12:46

0 Answers0