My program never releases the memory back. Why?

前端 未结 5 529
伪装坚强ぢ
伪装坚强ぢ 2020-11-30 14:41

I have a MDI program. When It starts it takes 2-3MB of RAM. Then, in this program I create about 260 MDI child windows (each has a TStringGrid, a bitmap and some other contr

5条回答
  •  情话喂你
    2020-11-30 15:09

    It is very well possible that FastMM does not show memory leaks upon application termination (for instance because all objects are TComponents that are owned, and the ownser frees them).
    But in the mean time, while running those components can still be around, and not freed soon enough.

    Did you use the FastMM unit that shows a form with the current memory usage?

    < Edit >
    This is the FastMMUsageTracker.pas in the directory ...\FastMM\Demos\Usage Tracker.
    Use that unit, then call the ShowFastMMUsageTracker function in it. You can refresh that form every once in a while to see how your memory consumption grows. I have put a FastMMUsageTrackerProject sample on-line, including an update of FastMM4 that makes it easier to check and debug memory leaks:

    • the form in the FastMMUsageTracker unit is now resizable, and the controls in it anchor in the right way
    • there is a new FastMmBootstrapUnit unit making debugging specific memory leaks easier

    Something I had at hand last week, was a 3rd party DLL, which was not written in Delphi.
    The DLL had a memory leak using Windows GlobalAlloc calls, which are not tracked by FastMM.

    NB: I'm about to post an update to FastMM on

    --jeroen

提交回复
热议问题