Re: [Gc] using a lot of finalizers?

Basile Starynkevitch <[email protected]> Wed, 25 May 2016 19:37:19 +0200
Newsgroups gmane.comp.programming.garbage-collection.boehmgc
Message-ID <[email protected]>
On 05/25/2016 07:14 PM, Basile Starynkevitch wrote:
[...]
> To be more precise:  Assuming you know a tiny bit of Scheme (or Lisp), 
> each MELT-monitor item is a Scheme-symbol like
> thing. It has a unique printable name. For example both im & 
> im__6u7e2UmXWwKFsm are printable names of items (and I would talk here 
> of a given item by using its printable name). They both share the same 
> radix "im". The first item im has no suffix, but the second item 
> im__6u7e2UmXWwKFsm has __6u7e2UmXWwKFsm as a suffix. Actually, the 
> suffix is some mangling (or name encoding) of a random 96 bits 
> suffix-number (with 0 corresponding to the lack of suffix). And that 
> suffix is unique for a given radix. So for the radix "ix" there is 
> only one item of suffix __6u7e2UmXWwKFsm.
>
> The printable names of items are unique, and are useful to persist a 
> subpart of the heap in some textual file(s). I want to be able to find 
> an item, given its radix and its suffix-number.
>
>>
>>
>> But the question that must be asked is: WHY do you want so many 
>> finalizers? What will they do?
>> This is usually a sign of a bad design.
>
> I have a "weak symbol table" mapping radix & suffix-number to symbols. 
> So I am able, given a string like "im__I am managing it by having, 
> inside each radix, some big array (allocated with GC_MALLOC_ATOMIC) 
> holding some hash-table. The item's finalizer would remove the entry 
> in that hash-table.

Sorry for the typo in the above paragraph: Should be:

I have a "weak symbol table" mapping radix & suffix-number to symbols. 
So I am able, given a string like "im__6u7e2UmXWwKFsm" to find the item 
of that printable name (by first converting the suffix I 
"__6u7e2UmXWwKFsm" to the equivalent suffix-number). I am managing that 
"weak symbol table"  by having, inside each radix, some big array 
(allocated with GC_MALLOC_ATOMIC) holding some hash-table. And of course 
I have a dictionnary of radixes. The item's finalizer would remove the 
entry in that hash-table (specific to its radix).

>
> Since each item is finalized, I am sometimes able to manage payloads 
> inside items which wants to be finalized, such as files or HTML 
> identifiers.
>
> Do you have some other suggestion to implement that?
>

Regard, thanks for reading!

-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***