guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Marking weak alist vectors, epilogue


From: Ludovic Courtès
Subject: Re: [PATCH] Marking weak alist vectors, epilogue
Date: Mon, 09 Jan 2006 15:51:37 +0100
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux)

Hi all,

address@hidden (Ludovic Courtès) writes:

> Below is an improved version of the patch I originally sent.  The goal
> of the original patch (and associated test case) was to ensure that an
> object associated to a weak key (resp. a weak value) is GC'd _after_
> that key (resp. value).
>
> However, as Han-Wen pointed out earlier in this thread, with the
> original patch, cyclical structures within a weak-key (or weak-value)
> alist vectors would never become unmarked.

I'm afraid no one cares but this second patch is somewhat broken, too,
in that its delayed marking phase (iterating through MARK_QUEUE) is "not
deferred enough".  Iterating though MARK_QUEUE should be done after
_all_ weak vectors have been traversed in `scm_i_remove_weaks ()'.

Implementing it would require to know the total number of weak vectors
so that, at the beginning of `scm_i_remove_weaks ()' we can allocate (on
the stack) a vector of such "mark queues" and only iterate through it
before exiting.

I'm not going to do it I guess (i) because it is getting complicated and
(ii) well, because apparently no one feels concerned by the issue I was
trying to solve, so maybe it's just unimportant after all.  ;-)

Conclusions:

1. If we're not going to solve this problem, at least it should be very
   well documented.

2. The test case currently in CVS is broken and could be either removed
   or replaced by something along the lines of what I posted earlier (I
   mean `weaks.test').

3. I had posted the tiny fix below which still seems valuable.


Thanks,
Ludovic.


--- orig/libguile/properties.c
+++ mod/libguile/properties.c
@@ -125,6 +125,7 @@
 scm_init_properties ()
 {
   scm_properties_whash = scm_make_weak_key_hash_table (SCM_UNDEFINED);
+  scm_properties_whash = scm_permanent_object (scm_properties_whash);
 #include "libguile/properties.x"
 }
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]