Why doesn't my program's memory usage return to normal after I free memory?

前端 未结 3 1754
醉话见心
醉话见心 2020-12-19 07:09

consider the next sample application

program TestMemory;


{$APPTYPE CONSOLE}

uses
  PsAPI,
  Windows,
  SysUtils;

function GetUsedMemoryFastMem: cardinal;         


        
3条回答
  •  情书的邮戳
    2020-12-19 07:47

    Any memory manager (including FastMM) incurs some overhead, otherwise Delphi could have just used the Windows memory management.

    The difference you observe is the overhead:

    • structures that FastMM uses to keep track of memory usage,
    • pieces of memory that FastMM did not yet return to the Windows memory management to optimize similar memory allocations in the future.

提交回复
热议问题