Board index » delphi » Re: Garbage collection and Delphi 9/Win32

Re: Garbage collection and Delphi 9/Win32


2004-04-19 10:52:26 PM
delphi71
Charles Pope <XXXX@XXXXX.COM>writes:
Quote
>The only real complication was in finalization of
>routines; the Boehm GC has support for finalization callbacks, and I
>hooked Delphi into them my creating a 'MarkForFinalization(Self);'
>routine and inserting into classes which needed them.

I haven't really used the finalizer side, although the original person
who developed some delphi classes did come up with a base object which
you could derive from if you wanted finalization.
That isn't necessary. You can set up the finalizer callback to call
TObject.Destroy without needing any interference with the class.
Quote
Although, like in Java - I am not sure it is the sort of thing one
would use too often.
Exactly.
--
Barry Kelly
If you think the problem is bad now, just wait until we've solved it.
-- Arthur Kasspe
 
 

Re: Garbage collection and Delphi 9/Win32

I have been using Delphi since version 1 (and Turbo Pascal since version 1
for CP/M), and the only third-party product that I have used in over twenty
years of using Borland products is "kbmMW."
 

Re: Garbage collection and Delphi 9/Win32

Quote


I suggest that Delphi should include it out of the box.

You mean "in the box". Out of the box would be anywhere else but in the
box... ;-)
--
Anders Ohlsson - Borland Developer Relations - bdn.borland.com/
Borland Software Corporation - www.borland.com/ - Excellence Endures
Enabling our customers to move into the future without abandoning their past
homepages.borland.com/aohlsson/blog_beta/
homepages.borland.com/aohlsson/blog_beta/
 

Re: Garbage collection and Delphi 9/Win32

Barry Kelly <XXXX@XXXXX.COM>writes:
Quote
It's very easy to add garbage collection to Delphi. I have done it a
number of times using the Boehm conservative GC compiled into a DLL,
and replacing the TMemoryManager with GetMemoryManager /
SetMemoryManager routines in the System unit.
I've added a simple demo app with full source code to CodeCentral, in
the Delphi/API section (as in Garbage Collection API): 21646.
codecentral.borland.com/codecentral/ccweb.exe/listing
Included in the archive is the Boehm GC compiled into a DLL, full
source code for the DLL, two units which make using the GC easy, and a
sample application.
--
Barry Kelly
If you think the problem is bad now, just wait until we've solved it.
-- Arthur Kasspe
 

Re: Garbage collection and Delphi 9/Win32

"Anders Ohlsson (Borland)" <XXXX@XXXXX.COM>writes:
Quote
>I suggest that Delphi should include it out of the box.

You mean "in the box". Out of the box would be anywhere else but in the
box... ;-)
Let me make it explicit:
When you take it out of the box and install it on your {*word*269} system,
it should include garbage collection support when compiling for Win32
as a target.
I.e. "out of the box".
If it is in the box, it is not much good to you...
<g>
--
Barry Kelly
If you think the problem is bad now, just wait until we've solved it.
-- Arthur Kasspe
 

Re: Garbage collection and Delphi 9/Win32

Barry Kelly <XXXX@XXXXX.COM>writes:
Quote
I was thinking about one of the strategic goals of Borland re Delphi,
Win32 and .NET: cross-compatibility using VCL or VCL.NET according to
platform.
I have to say I am a bit disappointed about the paucity of response to
this message. Personally, I think it is vital that Delphi 9/Win32
includes a garbage collector.
Don't people care about Delphi? If people disagree, why don't they say
why?
--
Barry Kelly
If you think the problem is bad now, just wait until we've solved it.
-- Arthur Kasspe
 

Re: Garbage collection and Delphi 9/Win32

Barry Kelly writes:
Quote
If people disagree, why don't they say
why?
Okay -- I disagree, and here's why.
I like managing my own memory, and I think a garbage collector adds
unnecessary overhead to my Win32 apps.
--
Nick Hodges -- TeamB
Lemanix Corporation -- www.lemanix.com
Read my Blog -- www.lemanix.com/nick
 

Re: Garbage collection and Delphi 9/Win32

"Nick Hodges (TeamB)" <XXXX@XXXXX.COM>writes:
Quote
Barry Kelly writes:

>If people disagree, why don't they say
>why?

Okay -- I disagree, and here's why.

I like managing my own memory, and I think a garbage collector adds
unnecessary overhead to my Win32 apps.
I said as an option. As in, compiler option. In Delphi/.NET it is not
an option - you have to live with GC, like it or not.
Wouldn't you agree that GC *as* *an* *option* for Delphi 9/Win32 would
be a benefit by adding extra source-code-level compatibility with
Delphi 9/.NET?
I'm not trying to start a discussion on the merits or disadvantages of
garbage collection.
Just saying that anything that makes Delphi cross-compatible between
Win32 and .NET would help what I see to be Delphi's only visible
strategy right now.
--
Barry Kelly
If you think the problem is bad now, just wait until we've solved it.
-- Arthur Kasspe
 

Re: Garbage collection and Delphi 9/Win32

Barry Kelly writes:
It is an option now, right? Not out of the box, but you seem to have
such a library that people seeking such things can find.
Quote
Wouldn't you agree that GC as an option for Delphi 9/Win32 would
be a benefit by adding extra source-code-level compatibility with
Delphi 9/.NET?
Not really. One should be writing Win32-friendly code in any version
of Delphi, even Dephi 8 --
www.lemanix.com/nick/archive/2004/03/25/252.aspx
--
Nick Hodges -- TeamB
Lemanix Corporation -- www.lemanix.com
Read my Blog -- www.lemanix.com/nick
 

Re: Garbage collection and Delphi 9/Win32

"Barry Kelly" <XXXX@XXXXX.COM>writes
Quote
I have to say I am a bit disappointed about the paucity of response to
this message. Personally, I think it is vital that Delphi 9/Win32
includes a garbage collector.
I would love to see it personally though I am not sure I'd label it as
'vital'. If it required major engineering effort to make happen I doubt it
would be worth it given a general shift to .Net over the longer term. I have
been having fun toying with the D language, check it out for an example of a
garbage collected environment married to a traditional compiled language.
Gerald
 

Re: Garbage collection and Delphi 9/Win32

"Nick Hodges (TeamB)" <XXXX@XXXXX.COM>writes:
Quote
Barry Kelly writes:

It is an option now, right? Not out of the box, but you seem to have
such a library that people seeking such things can find.
Sure, on CodeCentral entry #21646. But people (e.g. management) who
only read the checklist on the box won't see this. My posting was
motivated by John Kaster's reply earlier, where only 10% or so of
Delphi programmers used a third-party library.
Quote
>Wouldn't you agree that GC as an option for Delphi 9/Win32 would
>be a benefit by adding extra source-code-level compatibility with
>Delphi 9/.NET?

Not really. One should be writing Win32-friendly code in any version
of Delphi, even Dephi 8 --

www.lemanix.com/nick/archive/2004/03/25/252.aspx
I cannot agree. I don't want to get into a discussion about the merits
or otherwise of GC. I will however point out several things:
1. Very few objects require finalization - try/finally is redundant
for more than 95% of classes with the presence of a GC. Obviously that
subjective statistic depends on the number of classes in your system,
but consider this: only classes controlling resources need
finalization. The number of different kinds of resources is pretty
fixed, while the number of different kinds of classes grows with
program size and complexity. The redundancy can only increase.
2. Programming in an environment with explicit memory management
requires the maintenance of an ownership relationship, both
conceptually and in data structures. Often this ownership relationship
is irrelevant and redundant, bookkeeping useful *only* for disposing
memory.
Having said that, my argument is not for garbage collection per se;
I'm merely pointing out that the style of programming that Delphi/.NET
permits won't be supported in Delphi/Win32 without a garbage
collector.
--
Barry Kelly
If you think the problem is bad now, just wait until we've solved it.
-- Arthur Kasspe
 

Re: Garbage collection and Delphi 9/Win32

I think it is a reasonably good idea, so long as it is optional. Many
people seem to prefer managing memory themselves. And you don't want
to break too much old code either. But if it can be done optionally
and compatibly, I am in agreement.
On Tue, 20 Apr 2004 18:54:11 +0100, Barry Kelly
<XXXX@XXXXX.COM>writes:
Quote
I have to say I am a bit disappointed about the paucity of response to
this message. Personally, I think it is vital that Delphi 9/Win32
includes a garbage collector.
 

Re: Garbage collection and Delphi 9/Win32

Barry Kelly writes:
Quote
Wouldn't you agree that GC as an option for Delphi 9/Win32 would
be a benefit by adding extra source-code-level compatibility with
Delphi 9/.NET?
Honestly, I don't see it leading to increased sales. How do you
market it? Who cares?
-Brion
 

Re: Garbage collection and Delphi 9/Win32

Barry Kelly writes:
Quote
Very few objects require finalization
Very true, and I totally agree.
However, continuing to do try...finally...end; in Delphi is a really,
really good habit to stay in in my view.
Quote
I'm merely pointing out that the style of programming that Delphi/.NET
permits won't be supported in Delphi/Win32 without a garbage
collector.
Permits -- yes. /Should/ be used -- no.
--
Nick Hodges -- TeamB
Lemanix Corporation -- www.lemanix.com
Read my Blog -- www.lemanix.com/nick
 

Re: Garbage collection and Delphi 9/Win32

Barry Kelly writes:
Quote
Don't people care about Delphi? If people disagree, why don't they say
why?
Or how about this: What would you be willing to forego in order to
have this feature?
--
Nick Hodges -- TeamB
Lemanix Corporation -- www.lemanix.com
Read my Blog -- www.lemanix.com/nick