was ist neu ¦  programmier tips ¦  indy artikel ¦  intraweb artikel ¦  informationen ¦  links ¦  interviews
 sonstiges ¦  tutorials ¦  Add&Win Gewinnspiel

Tips (1541)

Dateien (137)
Datenbanken (90)
Drucken (35)
Grafik (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Mathematik (76)
Multimedia (45)
Oberfläche (107)
Objekte/
ActiveX (51)

OpenTools API (3)
Sonstiges (126)
Strings (83)
System (266)
VCL (242)

Tips sortiert nach
Komponente


Tip suchen

Tip hinzufügen

Add&Win Gewinnspiel

Werbung

51 Visitors Online


 
...Speicher-Leaks aufspüren?
Autor: Jochen Fromm
[ Tip ausdrucken ]  

Tip Bewertung (19):  
     


procedure TForm.DebugProcessStatus(s: string);
var 
  
pmc: PPROCESS_MEMORY_COUNTERS;
  cb: Integer;
  MemStat: tMemoryStatus;
begin
  
MemStat.dwLength := SizeOf(MemStat);
  GlobalMemoryStatus(MemStat);

  // Get the total and available system memory
  
TotalMemoryLabel.Caption := 'Total system memory: ' +
    FormatFloat('###,###', MemStat.dwTotalPhys / 1024) + ' KByte';
  FreeMemoryLabel.Caption  := 'Free physical memory: ' +
    FormatFloat('###,###', MemStat.dwAvailPhys / 1024) + ' KByte';

  // Get the used memory for the current process
  
cb := SizeOf(TProcessMemoryCounters);
  GetMem(pmc, cb);
  pmc^.cb := cb;
  if GetProcessMemoryInfo(GetCurrentProcess(), pmc, cb) then
  begin
    
NewWorkingMemory           := Longint(pmc^.WorkingSetSize);
    ProcessMemoryLabel.Caption := 'Process-Memory: ' +
      FormatFloat('###,###', NewWorkingMemory / 1024) + ' KByte';
    MemoryLeakLabel.Caption    := 'Memory Loss: ' +
      FormatFloat('###,###', (NewWorkingMemory - OldWorkingMemory) / 1024) + ' KByte';
    OldWorkingMemory           := NewWorkingMemory;
  end;
  FreeMem(pmc);

  DebugStatusLabel.Caption := 'Status: ' + s;
end;


 

Bewerten Sie diesen Tipp:

dürftig
ausgezeichnet


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners