IRC channel logs
2025-07-09.log
back to list of logs
<daviid>I should update the manual, to inform there is an easier way to patch guile, which is to clone, then cherry-pick lloda's wip-exception-truncate patch, like this: git cherry-pick ed5e37caa, then run the configure/make/install danse <lechner>I have some issues with premature garbage collection when interfacing with foreign libraries. What are the rules when memory becomes available for collection, please? <daviid>lechner: you need to keep track of your pointer to, we all have to ... <daviid>any *->pointer, you must keep the pointer and what it points to alive <daviid>I said all *->pointer, assuming you already keep any other arg alive ... <mwette>lechner: since c structs are encoded as bytevectors, they are not scanned for pointers, so you have to track those contents also ; guardians can be useful for this case <daviid>mwette: does ffi-help takes care of this 'for us'? <mwette>daviid: nope. That seems like a difficult problem to solve. <daviid>mwette: i am going to use fiil-helper to 'pre'bind fluidsynth, then write a (maybe goops based) idiomatic scheme layer <mwette>lechner: my bad (assumption). But anyhow, I've used guardians to hang on to pointers in the past. Here I'd add the object created by string->utf8. <lechner>mwette / thank you for that suggestion! do you have an example how to use a guardian? What does it mean for an object to be "no longer referenced from outside any guardian." please? <mwette>globally: (define myg (make-guardian)) ; later inside your procedure: (let ((bv (string->utf8 s))) (myg bv) (bytevector->pointer bv)) <lechner>dsmith / okay, thanks! the paper did it. <lechner>mwette / thanks! that was my question <lechner>mwette / do I have to release the hold the guardian has? <lechner>or is the key to let the guardian go out of scope? <mwette>you should when you know it's not used anymore; that's done with `(myg)' (which will release one item from the bag of items you put in it, IIRC. <mwette>I don't know what happens when a guardian goes out of scope. Good Q. <lechner>mwette / okay, thanks! do you have a favorite idiomatic way to release all items? <mwette>I don't have any good ones. I wonder if (while (g) 1) would work. <lechner>given the random nature of retrievals, wouldn't it be nicer if the guardian returned all of them at once? <mwette>I don't know. Maybe that is to prevent GC CPU utilization spikes (from running all the finalizers at once). <lechner>okay, thanks! your suggestion of a guardian is going to help a bunch of my projects. i have been getting desperate to trick the garbage collector. thanks so much! <dodoyada>is there any implementation of server sent events (sse) for either (web server), (fibers web server), or otherwise already out there? <wingo>wip-whippet status: i think i have fixed all the trace-related bugs. remaining work is bugs around heuristics about when to grow the heap, and bugs related to making sure that all threads can promptly be brought to a halt. <wingo>also, whippet currently only works on gnu/linux with gcc. (for clang, i need to fix all the atomic ops to cast to _Atomic; for other platforms, i need to add the necessary backend support for tracing data segments and finding stack bounds.) <wingo>i had never seen that video before :)