如何在Delphi应用程序中分析过多的内存消耗(PageFileUsage)? [英] How to analyze excessive memory consumption (PageFileUsage) in a Delphi Application?

查看:1089
本文介绍了如何在Delphi应用程序中分析过多的内存消耗(PageFileUsage)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是对这个问题的后续行动:的源代码直观地查看,并按照建议使用FastMMUsageTracker.pas 这里


This is a follow-up to this question: What could explain the difference in memory usage reported by FastMM or GetProcessMemoryInfo?

My Delphi XE application is using a very large amount of memory which sometimes lead to an out of memory exception. I'm trying to understand why and what is causing this memory usage and while FastMM is reporting low memory usage, when requesting for TProcessMemoryCounters.PageFileUsage I can clearly see that a lot of memory is used by the application.

I would like to understand what is causing this problem and would like some advise on how to handle it:

  • Is there a way to know what is contained in that memory and where it has been allocated ?
  • Is there some tool to track down memory usage by line/procedure in a Delphi application ?
  • Any general advise on how to handle such a problem ?

EDIT 1 : Here are two screenshots of FastMMUsageTracker indicating that memory has been allocate by the system.

  • Before process starts:

  • After process ends:

Legend: Light red is FastMM allocated and dark gray is system allocated.

I'd like to understand what is causing the system to use that much memory. Probably by understanding what is contained in that memory or what line of code or procedure did cause that allocation.

EDIT 2 : I'd rather not use the full version of AQTime for multiple reasons:

  • I'm using multiple virtual machines for development and their licensing system is a PITA (I'm already a registered user of TestComplete)
  • LITE version doesn't provide enough information and I won't waste money without making certain the FULL version will give me valuable information

Any other suggestions ?

解决方案

Another problem might be heap fragmentation. This means you have enough memory free, but all the free blocks are to small. You might see it visually by using the source version of FastMM and use the FastMMUsageTracker.pas as suggested here.

这篇关于如何在Delphi应用程序中分析过多的内存消耗(PageFileUsage)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆