Recent

Author Topic: How to determine maximum memory used by a program?  (Read 980 times)

Robert.Thompson

  • Jr. Member
  • **
  • Posts: 56
  • "A very bad coder."
    • Google Voice for Canadians
How to determine maximum memory used by a program?
« on: December 31, 2017, 07:24:04 pm »
Hello:

Is there a way to determine the maximum amount of memory that my program used during its' execution?

Thanks,

Rob.
Lazarus:  1.8.4  2018-11-17
FPC:   3.0.4 x86_64-linux-gtk2
System:   Kernel: 4.15.0-39-generic x86_64 bits: 64 gcc: 7.3.0 Cinnamon 3.8.9 Linux Mint 19 Tara
              Phoenix v: 11JB.M044.20100622.hkk date: 06/22/2010
Intel Core i5 M 460 (-MT-MCP-) arch: Nehalem rev.5 cache: 3072 KB
NVIDIA GeForce 310M

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7311
Re: How to determine maximum memory used by a program?
« Reply #1 on: December 31, 2017, 07:39:12 pm »
You can get an idea using the values returned by this call:

https://www.freepascal.org/docs-html/rtl/system/getfpcheapstatus.html

The interpretation is a bit difficult though.

Robert.Thompson

  • Jr. Member
  • **
  • Posts: 56
  • "A very bad coder."
    • Google Voice for Canadians
Re: How to determine maximum memory used by a program?
« Reply #2 on: January 01, 2018, 03:48:32 pm »
Thank you. :)
Lazarus:  1.8.4  2018-11-17
FPC:   3.0.4 x86_64-linux-gtk2
System:   Kernel: 4.15.0-39-generic x86_64 bits: 64 gcc: 7.3.0 Cinnamon 3.8.9 Linux Mint 19 Tara
              Phoenix v: 11JB.M044.20100622.hkk date: 06/22/2010
Intel Core i5 M 460 (-MT-MCP-) arch: Nehalem rev.5 cache: 3072 KB
NVIDIA GeForce 310M

devEric69

  • Full Member
  • ***
  • Posts: 109
Re: How to determine maximum memory used by a program?
« Reply #3 on: May 16, 2019, 05:09:00 pm »
For information, if the cmem unit is somewhere in "uses" ( http://wiki.lazarus.freepascal.org/CMem ), then GetFPCHeapStatus returns 0 for all memory quantities (normal behaviour).
« Last Edit: May 16, 2019, 05:12:34 pm by devEric69 »
use: Ubuntu 18.04 + Laz. 1.8.5 + FPC 3.0.5 (64 bits).