symbol tables never compacted

Bug #301993 reported by Denis Koreshkov
2
Affects Status Importance Assigned to Milestone
Ikarus Scheme
Fix Committed
Medium
Abdulaziz Ghuloum

Bug Description

Once a symbol has been interned, it is never removed from its symbol table.
e.g.
  (do ((i 0 (+ i 1))) (#f) (string->symbol (number->string i)))
never stops growing despite the fact nobody uses all those created symbols.

This may cause problems with applications using symbols to represent words ans strings.

It is surely possible to implement gc pass to get rid of symbols which are
 1) not referenced by anyone except car of some symbol-table-bucket
 2) have empty property-list and unique-string slots.

I am aware that the pass can actually be a slowdown to both gc and intern_string,
but on the other hand it is wrong allowing junk to pile up in a garbage-collected system.

Related branches

Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote : Re: [Bug 301993] [NEW] symbol tables never compacted

On Nov 25, 2008, at 6:17 AM, Denis Koreshkov wrote:

> It is surely possible to implement gc pass to get rid of symbols
> which are
> 1) not referenced by anyone except car of some symbol-table-bucket
> 2) have empty property-list and unique-string slots.
   3) do not have a value set

Yes. I did that before (in a previous incarnation of ikarus).

> I am aware that the pass can actually be a slowdown to both gc and
> intern_string,

No, I don't think it would cause any slowdown. It just adds a little
complexity to the gc.

> but on the other hand it is wrong allowing junk to pile up in a
> garbage-collected system.

Agreed of course. The only problem is that I won't be able to get
around to doing this for some time due to pressure (school and all).

Changed in ikarus:
assignee: nobody → aghuloum
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote :

I tried implementing this today and noticed (from the looks of the implementation) that there might be a surprise: if you weak-cons a symbol that has no other references, it might get bwipped. I tried Chez which I know collects its symbol table and yes, it behaves as I expected:

$ petite
Petite Chez Scheme Version 7.4
Copyright (c) 1985-2007 Cadence Research Systems

> (define q (weak-cons 'abracarabra '()))
> q
(abracarabra)
> (collect 5)
> q
(#!bwp)
>

I can justify the behavior, but I think it's still a little surprising. Need to think about it more (or get over it is the better word maybe).

Let me know if you have any feedback.

Aziz,,,

Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote :

Fixed in revision 1700.

Changed in ikarus:
status: Confirmed → Fix Committed
Changed in ikarus:
milestone: none → 0.0.4
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.