Mon, 1 Mar 1999 10:37:30 -0800
"Lipscomb, Kevin" <[log in to unmask]> writes:
> As one might imagine, memory leaks are a great concern to us. Does anyone
> know of a collection of software components in Ada that provide
> reference-counted objects? How about bindings, or binding wrappers, that
> provide reference-counting?
I just submitted two articles about reference-counted lists to the
patterns archive (Feb 99) at the ACM.
Do a substring search for "ada.finalization.controlled" in the archive,
for lots of examples of how to automatically reclaim memory during
finalization of an object.
> In the book, _Design Patterns_, reference-counted objects are covered in the
> section on the pattern Proxy. Unfortunately, I have not read the entire
> book yet (I will, I promise.) Can anyone recommend other patterns that are
> particularly applicable in the domain of high-availability software
> applications -- design patterns that we'd really be foolish to be without?
You should understand the idiom for a dispatching deconstructor, to free
objects designated by a pointer to a class-wide type. Most of my
articles since last Oct or so have used this idiom. Do a substring
search for "do_free" and see what drops out.
In my most recent post I show how to implement a smart pointer, that
reference-counts the object designated by the pointer, then
automatically reclaims the object when there are no more references.
After you compare it to the old way of doing things (with access
objects), you won't go back.
I've been converting all the examples in the Design Book to Ada95, and
posting the articles to the patterns mailing list. You can subscribe by
sending the message (body):
subscribe patterns <your full name>
to the ACM mailing-list server.
<mailto:[log in to unmask]>