AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Class, records and memory leaks

Ein Thema von WojTec · begonnen am 23. Jan 2013 · letzter Beitrag vom 23. Jan 2013
 
WojTec

Registriert seit: 17. Mai 2007
482 Beiträge
 
Delphi XE6 Professional
 
#1

Class, records and memory leaks

  Alt 23. Jan 2013, 12:15
Delphi-Version: 2010
I just bought EL7 and checked project with it. It found some memory leaks (I thought that TListView.TListItem.Data can be free automatically, but ok, I did it manually). But I have yet another leak and I don't know WTF

So, I'm adding to TListView simple class with 2 reintroduced constructors and a few record field (some record fields has another record field). On object create I only need to alloc memory and init one field (fill record with valid data) - parameter in one constructor. This record has 2 string fields and for next operations in proggy it have to valid values. To make sure record contain valid data I'm filtering input by function - it sets valid values in record, then function result is passed as constructor parameter (and second constructor doing the same, but itself internally). All is oke, hmm, it isn't oke - at the program termination EL reporting memory leaks in function that setting valid data for constructor. All in pseudocode:

Code:
button click:
 AddItem(TObj.Create(foonction(input1, input2: str))) // <-- point 1

foonction(param1, param2: str): record;
 result.param1 := extractdata1()
 result.param2 := extractdata2()

 result := formatit(result) // <-- point 2

formatit (record): record;
 do format fields strings

point 3 in EL log is in System._NewUnicodeString
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:20 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz