[MUD-Dev] Re: openmud: open issues

Vadim Tkachenko vt at freehold.crocodile.org
Fri Oct 30 19:51:18 CET 1998


James Wilson wrote:
> 
> On Thu, 29 Oct 1998, Vadim Tkachenko wrote:

> >> 8. memory management: garbage collection? explicit allocation/deallocation?
> >
> >At least some kind of smart pointer with a mark-n-sweep or reference
> >counter, the latter is better in the languages like C++ where it's
> >possible to have static/automatic objects behave as their dynamic
> >counterparts (explanation will follow if there's enough demand; I had a
> >very stable implementation working exactly the same for MS-DOS, Windows
> >and OS/2, only Java prevented it from existing in UNIX incarnation)
> 
> reference counting? how do you reclaim cycles?

Honestly, I didn't ;-) My concern when I was developing the reference
counting scheme was this:

I add object A to container C1.
I add object A to container C2.

Then, one of the following happens:

- One of the containers dies. How do I know what to do with the object?
RC solves this problem.
- Both containers die. Object A dies, too (RC drops to 0).
- Automatic object A goes beyond the scope. If its RC is not 0, boom.

Most problematic part was to make sure the static, automatic and dynamic
objects are handled in the same way. To do that, static and automatic
objects get RC=1 at the creation time, and in the destructor before
checking RC I decrement it.

I guess, the cycles weren't resolved properly, but it's difficult to
tell because the last line in C++ for me was in 1994.

> James

--
Still alive and smile stays on,
Vadim Tkachenko <vt at freehold.crocodile.org>
--
UNIX _is_ user friendly, he's just very picky about who his friends are




More information about the mud-dev-archive mailing list