Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Ressourcenleck finden (https://www.delphipraxis.net/30768-ressourcenleck-finden.html)

Mario 29. Sep 2004 07:00


Ressourcenleck finden
 
Hallo,

ich habe meine Anwendung mit MemCheck prüfen lassen:

Code:
MemCheck version 2.70

Total leak: 320 bytes


*** MEMCHK: Blocks STILL allocated ***

Leak #0 Reallocated memory (ReallocMem)
   Size: 304
   1 Occurence
   call stack - 0 : (no debug info) Find error: 4002F85C
   call stack - 1 : (no debug info) Find error: 40034B25
   call stack - 2 : (no debug info) Find error: 40035525
   call stack - 3 : (no debug info) Find error: 4003CABA
   call stack - 4 : (no debug info) Find error: 00E7DC00
   call stack - 5 : (no debug info) Find error: 40036330
   call stack - 6 : (no debug info) Find error: 400332F7
   call stack - 7 : (no debug info) Find error: 4002EB40
   call stack - 8 : (no debug info) Find error: 4002ECCA
   call stack - 9 : (no debug info) Find error: 4002ED5B
   call stack - 10 : (no debug info) Find error: 00E7D586
   call stack - 11 : Module MAIN.PAS Routine @Main@TMainForm@FormCreate Line 274 Find error: 00646784
   call stack - 12 : (no debug info) Find error: 00E7D9A3
   call stack - 13 : (no debug info) Find error: 00E7D60A
   call stack - 14 : (no debug info) Find error: 00E8580C
   call stack - 15 : Module Compufix.dpr Routine initialization Line 70 Find error: 0065D84D
   call stack - 16 : (no debug info) Find error: BFF8B55C
   call stack - 17 : (no debug info) Find error: BFF8B40E
   call stack - 18 : (no debug info) Find error: BFF89DD1

Leak #1 User allocated memory (GetMem)
   Size: 16
   1 Occurence
   call stack - 0 : (no debug info) Find error: 4000CBEF

*** MEMCHK: End of allocated blocks ***


*** MEMCHK: Chronological leak information ***


* User allocated memory (GetMem) (Leak #1) Size: 16
* Reallocated memory (ReallocMem) (Leak #0) Size: 304

*** MEMCHK: End of chronological leak information ***


*** MEMCHK: Blocks written to after destruction ***

   Bad blocks count: 0


*** MEMCHK: End of blocks written to after destruction ***
Die Speicherverwaltung ist scheinbar in Ordnung, jedenfalls mache ich mir bei 320Byte Verlust keine großen Gedanken und weiß auch nicht mehr wonach ich suchen soll :wall:

Nun aber zu einem einhergehenden Problem. Ich kann unter Windows 98 mit der Anwendung durch wiederholten Bildschirmaufbau die Ressourcen erschöpfen und das System zum Absturz bringen. Ich weiß nur leider nicht, wo die Ressourcen hin verschwinden. Kann mir einer einen Tipp geben, wie ich den Übeltäter ausfindig machen kann?

Mario 29. Sep 2004 08:55

Re: Ressourcenleck finden
 
Also, ich konnte das Problem zum Glück lösen :) indem ich Teile des Codes auskommentiert habe.

Letztendlich habe ich bei der Ausgabe auf ein Canvas mittels SelectObject diesen Hinweis nicht beachtet:
Zitat:

This function returns the previously selected object of the specified type. An application should always replace a new object with the original, default object after it has finished drawing with the new object.
Das Speichern des Rückgabewertes und zurückselektieren konnte das Problem lösen :cheers:


Alle Zeitangaben in WEZ +1. Es ist jetzt 00:19 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz