Sir R. M8gic1an
2011-02-17 06:33:54
Im developing some things for myself & MSI, and I was wondering how / if I can check how much memory is currently being used?
~RM
~RM
2011-02-17 06:33:54
2011-02-17 06:37:18
2011-02-17 07:01:15
The include file (memcheck_laz.inc) contains the added features:
>
> procedure CheckHeap;
> procedure CheckHeap(const txt: ansistring);
> procedure CheckHeapWrtMemCnt(const txt: ansistring);
> procedure WriteGetMemCount(const txt: ansistring);
>
> function MemCheck_getmem_cnt: longint;
> function MemCheck_freemem_cnt: longint;
> function MemCheck_getmem_size: longint;
> function MemCheck_freemem_size: longint;
> function MemCheck_getmem8_size: longint;
> function MemCheck_freemem8_size: longint;
>
> You may want to change the longints to int64.
Program SmallApp;
function MessageBoxA(HWND: Cardinal; Msg,Title: pChar; Flags: Cardinal): Cardinal; stdcall; external 'User32.dll';
function SetProcessWorkingSetSize(hProcess: LongWord; dwMinimumWorkingSetSize, dwMaximumWorkingSetSize: LongWord): LongBool; stdcall; external 'kernel32.dll';
function GetCurrentProcess: LongWord; Stdcall; external 'kernel32.dll';
procedure Sleep(dwMilliseconds: LongWord); stdcall; external 'kernel32.dll';
begin
MessageBoxA(0,'Hello from a small app.','Small App',0);
SetProcessWorkingSetSize(GetCurrentProcess, $FFFFFFFF, $FFFFFFFF);
MessageBoxA(0,'Hello from a smaller app.','Small App',0);
SetProcessWorkingSetSize(GetCurrentProcess, $FFFFFFFF, $FFFFFFFF);
Sleep(30000);
end.
2011-02-17 07:05:42
2011-02-17 07:29:26
2011-02-17 07:37:39
From: Flight
I figured they weren't in Simba, but if you had "memcheck_laz.inc" could you not just include it and call it from your script/program? It seems like that's a global Pascal include file.
Here's the "memcheck_laz.inc" include:
http://lazarus.sourcearchive.com/lines/0.9.26-3/memcheck__laz_8inc-source.html
2011-02-18 05:29:20