Is the memory not reclaimed for Delphi apps running on Windows Server 2008 (sp1)?

后端 未结 8 1548
日久生厌
日久生厌 2021-01-03 10:13

We have a D2007 application whose memory footprint grows steadily when running on Windows Server 2008 (x64, sp1).
It behaves normally on Windows Server 2003 (x32 or x64)

8条回答
  •  长情又很酷
    2021-01-03 10:32

    Actually, Microsoft made a change to the Critical Sections to add some debug information. This debug memory is not released until the end of the application but somehow cached and reused which is why after a while it can plateau.

    The solution if you want to create a lot of Critical Sections without feeling this memory penalty is to patch the VCL code to replace calls to InitializeCriticalSection by calls to InitializeCriticalSectionEx and pass it the flag CRITICAL_SECTION_NO_DEBUG_INFO to avoid the creation of the debug structure.

提交回复
热议问题