Recent

Author Topic: How to automatically free classes/objects?  (Read 7213 times)

Leledumbo

  • Hero Member
  • *****
  • Posts: 8111
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: How to automatically free classes/objects?
« Reply #15 on: March 08, 2016, 12:27:26 pm »
With some thought it is possible to install e.g. the Bohm garbage collector when using old school objects.
If you've managed to write an fp memory manager with Boehm backend, then everything else would be using that memory manager and should work anywhere memory allocation is required. Not limited to old school objects or some other types.

Thaddy

  • Hero Member
  • *****
  • Posts: 9181
Re: How to automatically free classes/objects?
« Reply #16 on: April 03, 2016, 10:21:35 am »
With some thought it is possible to install e.g. the Bohm garbage collector when using old school objects.
If you've managed to write an fp memory manager with Boehm backend, then everything else would be using that memory manager and should work anywhere memory allocation is required. Not limited to old school objects or some other types.

Article 21646 by Barry Kelly on the delphi community forum.
I did one for KOL and another version for FPC if you are interested. But based on that code you are quite capable of doing that yourself in an hour or so.
It was discussed a couple of years ago with Florian.
Apart from performance issues (that could be/are overcome) Florian had several more objections, i believe because it also requires a paradigm shift and can not be used as is. You have to register objects for finalization, for one. But there is working code around, not only by Barry or me.
also related to equus asinus.

aradeonas

  • Hero Member
  • *****
  • Posts: 824
Re: How to automatically free classes/objects?
« Reply #17 on: April 03, 2016, 10:30:51 am »
I am not a pro in Pascal so I cant see through it but I see more libraries with Interface base system with main benefit of there is no need to free interfaces.

Thaddy

  • Hero Member
  • *****
  • Posts: 9181
Re: How to automatically free classes/objects?
« Reply #18 on: April 03, 2016, 10:47:31 am »
Interface based systems are essentially ARC. Garbage collection is different.
My work on garbage collection is more or less out of interest. For practical application I too prefer interface based management.
also related to equus asinus.

aradeonas

  • Hero Member
  • *****
  • Posts: 824
Re: How to automatically free classes/objects?
« Reply #19 on: April 03, 2016, 11:01:22 am »
Interface based systems are essentially ARC. Garbage collection is different.
My work on garbage collection is more or less out of interest. For practical application I too prefer interface based management.
That's the point I cant understand,why interfaces have this ability and why it didn't use more? I see more interface based management but is it really correct using interfaces for this subject and it is good really? If it is why there is a need for garbage collection?

Thaddy

  • Hero Member
  • *****
  • Posts: 9181
Re: How to automatically free classes/objects?
« Reply #20 on: April 03, 2016, 12:04:11 pm »
http://blogs.embarcadero.com/abauer/2013/06/14/38948

Is a good write up by the former chief engineer of Delphi.
also related to equus asinus.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7503
Re: How to automatically free classes/objects?
« Reply #21 on: April 03, 2016, 12:55:52 pm »
http://blogs.embarcadero.com/abauer/2013/06/14/38948

Is a good write up by the former chief engineer of Delphi.

No, not at all. It doesn't mention cycles.