Autor Beitrag
AScomp
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 162


Delphi 5, Delphi 7, Delphi 2007, Delphi 2009, Delphi XE, Delphi 10 Seattle
BeitragVerfasst: Di 13.09.11 13:58 
Hallo,

habe mit FastMM und FullDebugMode eine Liste einiger Speicher-Leaks bekommen, allerdings hilft mir die Liste nicht wirklich weiter.

Hauptsächlich sind es Leaks verursacht von UnicodeStrings:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
The block is currently used for an object of class: UnicodeString

13 - 20 bytes: Unknown x 123
21 - 36 bytes: UnicodeString x 10, Unknown x 2
37 - 52 bytes: UnicodeString x 39
53 - 68 bytes: UnicodeString x 8, Unknown x 3
69 - 84 bytes: UnicodeString x 2
85 - 100 bytes: TStringList x 11, Unknown x 1
341 - 388 bytes: Unknown x 1

Die TStringList ist mir bekannt, das verursacht eine Komponente zur Lokalisierung. Aber die UnicodeString- und Unknown-Leaks machen mir zu schaffen. Wie können denn UnicodeString-Leaks entstehen?

Hier mal ein Beispiel aus der Liste:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
A memory block has been leaked. The size is: 36

This block was allocated by thread 0x1738, and the stack trace (return addresses) at the time was:
4048F6 
407873 
407AA4 
48A764 [SysUtils][SysUtils][SysUtils.TEncoding.GetString]
48A719 [SysUtils][SysUtils][SysUtils.TEncoding.GetString]
4B0E75 [Classes][Classes][Classes.TReader.ReadString]
4ABCD2 [Classes][Classes][Classes.TStrings.ReadData]
4AECA9 [Classes][Classes][Classes.TReader.DefineProperty]
4AAF4D [Classes][Classes][Classes.TStrings.DefineProperties]
4B01F3 [Classes][Classes][Classes.TReader.ReadProperty]
4AFAE6 [Classes][Classes][Classes.TReader.ReadDataInner]

The block is currently used for an object of class: UnicodeString

The allocation number is: 115236


Viele Dank für jegliche Tipps!

Gruß

Andy

Moderiert von user profile iconNarses: Code-Tags hinzugefügt

---Moderiert von user profile iconNarses: Beiträge zusammengefasst---

Hallo,

interessanterweise hat sich die angesprochene Komponente als ursächlich für ALLE UnicodeString-Leaks herausgestellt. Dort wurde schlicht vergessen, eine TStringList wieder freizugeben.

Es bleiben nunmehr nur noch die Unknown-Leaks. Wie geht man hier am besten vor, um die Ursachen zu finden?

Danke und Gruß

Andy
Martok
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: Di 13.09.11 14:15 
user profile iconAScomp hat folgendes geschrieben Zum zitierten Posting springen:
Es bleiben nunmehr nur noch die Unknown-Leaks. Wie geht man hier am besten vor, um die Ursachen zu finden?
Unknown bedeutet ja nur, dass FastMM nicht direkt weiß, was da drin ist. Die Methode ist also genau die Gleiche: nimm die erstellte Logdatei und sieh dir den StackTrace an. Irgendwo da sollte etwas sein, was dir weiterhilft.

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."
AScomp Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 162


Delphi 5, Delphi 7, Delphi 2007, Delphi 2009, Delphi XE, Delphi 10 Seattle
BeitragVerfasst: Di 13.09.11 16:17 
Danke dir, so hab ich's gemacht. Waren allesamt Memory leaks in Fremdkomponenten, u.a. das FlatTabControl aus den Flatstyle-Komponenten war etwas unsauber.