![]() |
Delphi-Version: 2010
Class, records and memory leaks
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 :cyclops:
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:
:roll::?:
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 |
AW: Class, records and memory leaks
Alister Christie just published a new Video Tutorial for you
![]() Do you really think your pseudo code will give us a clue about the leaks? :roll: |
Re: Class, records and memory leaks
Zitat:
About leaks - now I'm not sure if any are in my proggy. EL6 and EL7 in v6 mode doesn't show any, but EL7 after disable backward compatibility reporting a few kB leaked... I don't know... |
AW: Class, records and memory leaks
Try to disable EL and verify the leaks with FastMM.
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 01:18 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-2025 by Thomas Breitkreuz