[Home] [Groups] - Message: [Prev in Group] [Next in Group]

nu.kanga.list.mud-dev

1533: Unique id's

[Full Header] [Plain Text]
From: "Chris Gray" <cg@ami-cg.GraySage.Edmonton.AB.CA>
Newsgroups: nu.kanga.list.mud-dev
Date: Wed, 9 Apr 97 07:00:54 MST
Organization: Kanga.Nu
[Shawn H:]

:Any magical algorithms? :)

Chris L is almost certainly different in details, so I'll just outline
what my stuff does. The unique id on anything is just its database id.
This is an index into a descriptor table that gives the offset and length
of the actual data in the database. Slots in the descriptor table are
reused when they are freed (there is space in them to make a simple
linked-list of the freed ones). When more are needed, the table just grows
on the end, so until freeing happens, dbids just start at 1 and go up.

Some systems specifically avoid re-using ids, in order to better catch
dangling pointers.

--
Chris Gray   cg@ami-cg.GraySage.Edmonton.AB.CA