Recent

Author Topic: [SOLVED] Memleak using TList from generics.collections  (Read 791 times)

araujo

  • Newbie
  • Posts: 2
[SOLVED] Memleak using TList from generics.collections
« on: May 14, 2024, 10:17:13 pm »
In a testing project, using TList<T> from the generics.collections unit, I identified that there is a memory leak.
When using the TFPGObjectList<T> class, from unit fgl, there is no memory leak.

Attached is an example project.
« Last Edit: May 27, 2024, 06:26:51 pm by araujo »

Thaddy

  • Hero Member
  • *****
  • Posts: 15139
  • Censorship about opinions does not belong here.
Re: Memleak using TList from generics.collections
« Reply #1 on: May 14, 2024, 10:51:30 pm »
In FGL you use an Tobjectlist, in generics.collections you should do the same. No leaks. Plz debug it. It will show you.
Of course the national anthem of the U.S.A. was written by Jimi Hendrix, didn't you know that?

PascalDragon

  • Hero Member
  • *****
  • Posts: 5576
  • Compiler Developer
Re: Memleak using TList from generics.collections
« Reply #2 on: May 14, 2024, 11:04:27 pm »
In a testing project, using TList<T> from the generics.collections unit, I identified that there is a memory leak.
When using the TFPGObjectList<T> class, from unit fgl, there is no memory leak.

TList<> does not free class instance, just like TFPGList<> doesn't or the non-generic TList doesn't.

The corresponding type to TFPGObjectList<> is TObjectList<>.

araujo

  • Newbie
  • Posts: 2
Re: Memleak using TList from generics.collections
« Reply #3 on: May 23, 2024, 09:17:34 pm »
I will make the changes.
Grateful for the attention.

 

TinyPortal © 2005-2018