guile-devel
[Top][All Lists]
Advanced

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

Re: “Too many root sets” when calling compile frequently


From: Jean Abou Samra
Subject: Re: “Too many root sets” when calling compile frequently
Date: Sat, 20 Aug 2022 13:08:25 +0200


> Le 19 août 2022 à 12:19, Maxime Devos <maximedevos@telenet.be> a écrit :
> 
> 
>> On 19-08-2022 00:18, Jean Abou Samra wrote:
>> Hi,
>> 
>> Calling the Guile compiler often causes this BDWGC error: “Too
>> many root sets”.
>> 
>> scheme@(guile-user)> (define-syntax-rule (repeat n expr expr* ...) (do ((i 0 
>> (1+ i))) ((eqv? i n)) expr expr* ...))
>> scheme@(guile-user)> (use-modules (system base compile))
>> scheme@(guile-user)> (repeat 10000 (compile 5))
>> Too many root sets
>> Abandon (core dumped)
>> 
>> Any idea what is going on here? Should I report it as a bug?
>> Is there a workaround?
>> 
>> Thanks,
>> Jean
> 
> IIRC, Guile used to support garbage collection of compiled code, but that 
> support has been removed.
> 
> I cannot find that in the Git history or NEWS, so maybe that's incorrect.
> 
> If that is correct, maybe with sufficient tests and care, support for 
> unloading compiled code can be restored, removing the call to GC_add_roots.


Thanks for your reply. I didn’t dig into the history yet, but I might do it 
later. For now, I have a question. What is the actual purpose of the 
GC_add_roots call? Is it just to give eternal protection to the objects pointed 
to by pointers in the memory section? In that case, wouldn’t it also work to 
create a bytevector from the root section and use scm_permanent_object on it? 
Or is this a subtlety where Guile registers its ELF bytecode as if it were a 
dynamic library (also ELF)?

It would be great if Guile supported garbage collection of loaded bytecode, but 
for my use case in LilyPond, it is actually not strictly  necessary. It should 
suffice not to error out on the nth call.

Jean






reply via email to

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