STL not release memory from System level

后端 未结 1 1164
滥情空心
滥情空心 2021-01-22 14:26

As I know STL has automatic memory management. But when I use something like top or ps -aux to show the memory usage of a process, it shows even the ST

相关标签:
1条回答
  • 2021-01-22 15:15

    This is completely normal. That's how operating systems work. If they spent all their time reclaiming tiny portions of memory from tiny processes, they'd never do anything else.

    You just have to trust that their complicated algorithms know what they're doing to get the best performance for your system.

    There are layers on layers on layers of logic that allocate physical RAM all the way up to the process's virtual memory.

    Going into extreme detail about how operating systems work would be both beyond the scope of this post, and pointless. However, you could enrol on a relevant teaching course if you really wanted to grok it all.

    If we were to forget about caching and virtual memory and such, even a simple rule of thumb might be summarised as follows: releasing memory from your program tells the OS it can have it back; that doesn't mean the OS must take it back.

    0 讨论(0)
提交回复
热议问题