Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure TraceMemUsage;
- var
- i, j: Integer;
- Form: TCustomForm;
- Msg: string;
- vResult: THeapStatus;
- begin
- vResult := GetHeapStatus;
- TraceLog.Trace('*** HEAP STATUS ***');
- TraceLog.Trace(Format(' Used memory Win32: %d', [MemoryUsed]));
- TraceLog.Trace(Format(' Total Adress Space: %d', [vResult.TotalAddrSpace]));
- TraceLog.Trace(Format(' Total Uncommitted: %d', [vResult.TotalUncommitted]));
- TraceLog.Trace(Format(' Total Committed: %d', [vResult.TotalCommitted]));
- TraceLog.Trace(Format(' Total Allocated: %d', [vResult.TotalAllocated]));
- TraceLog.Trace(Format(' Total Free: %d', [vResult.TotalFree]));
- TraceLog.Trace(Format(' Free Small: %d', [vResult.FreeSmall]));
- TraceLog.Trace(Format(' Free Big: %d', [vResult.FreeBig]));
- TraceLog.Trace(Format(' Unused: %d', [vResult.Unused]));
- TraceLog.Trace(Format(' Overhead: %d', [vResult.Overhead]));
- TraceLog.Trace(Format(' Heap Error Code: %d', [vResult.HeapErrorCode]));
- TraceLog.Trace(Format(' AllocMemSize: %d', [AllocMemSize]));
- TraceLog.Trace(Format(' AllocMemCount: %d', [AllocMemCount]));
- TraceLog.Trace('*** FORM STATUS ***');
- TraceLog.Trace(Format('There are %d forms remaining in memory.', [Screen.CustomFormCount]));
- for i := 0 to Screen.CustomFormCount-1 do
- begin
- Form := Screen.CustomForms[i];
- Msg := '#' + IntToStr(i+1) +
- ' ClassName=' + Form.ClassName +
- ' Name=' + Form.Name +
- ' Visible=' + BoolToStr(Form.Visible, True) +
- ' Owner=';
- if Assigned(Form.Owner) then
- Msg := Msg + Form.Owner.ClassName
- else
- begin
- Msg := Msg + 'NIL -- COMPONENTS:';
- for j := 0 to Form.ControlCount-1 do
- Msg := Msg + Form.Controls[j].Name + ', ';
- end;
- TraceLog.Trace(Msg);
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement