IRC channel logs

2021-03-24.log

back to list of logs

<soda__hobart>ok, my "delete-my-struct" function does not appear to be actually freeing any memory
<soda__hobart>like if i allocated 500mb, and i see the memory usage in htop tick up by 500mb, and then i call my delete function on all those structs i just made, i should be able to see the memory usage drop in htop, right?
<leoprikler>Not necessarily. The operating system can let you keep that memory if it feels you're just going to use it again anyway.
<leoprikler>you should really do a valgrind there
<soda__hobart>yeah, i think valgrind will help me get to the bottom of it
<leoprikler>[that said, 500mb feels large and the operating system would likely want that memory back if you're not using it]
<soda__hobart>bluh... i think the problem is because i make this lcrs binary tree recursively, and then flatten it into an array so it can be serialized, but it looks like i'm only freeing the root node of the original tree
<soda__hobart>yay, it worked! i'm still leaking memory, but a lot less now :]
<wingo>o/
<rekado_>I’ve got a little server here that produces a long stream of binary data
<rekado_> https://elephly.net/paste/1616572710.html
<rekado_>the client uses “echo '"something"' | nc ip 2904 > foo” to receive the stream
<rekado_>I notice that the data stream is always truncated on the receiver
<rekado_>a couple dozen trailing bytes are missing
<rekado_>I got closer to the full data stream by disabling buffering
<rekado_>my guess is that the server kills the connection before everything has been sent.
<rekado_>shouldn’t “(force-output client)” do the right thing here?
<rekado_>or is it perhaps buffering in the command that generates the data stream…?
<rekado_>(the actual code doesn’t use “display” but the Guix API)
<ArneBab>does someone have a package for wrk?
<wingo>rekado_: do you need to read the newline off the input or something?
<wingo>is there some kind of nagle algorithm in effect?
*rekado_ doesn’t know
<rekado_>I note that on the same host everything is received
<rekado_>across the network the last bytes are missing
<rekado_>it’s not always the same amount that’s missing
<wingo>weird
<rekado_>wingo: setting TCP_NODELAY on the socket seems to have fixed it, so it seems that your nagle algorithm guess was spot on
<rekado_>thanks!
<wingo>yay
<wingo>oddly guile's core web server doesn't set that flag but the fibers one does
<wingo>:unicode_shrug:
<ArneBab>wingo: are you looking into the fibers server right now?
<ArneBab>(if not, please just say no — I don’t want to clobber your context, it’s just that I have some longstanding questions about small parts of it)
<lle-bout>hey, is there a way to speed up GNU Guile checking for .go files?
<lle-bout>All these stat calls on startup
<dsmith-work>UGT Greetings, Guilers
<civodul>lle-bout: you can read at issues.guix.gnu.org what i did for the 'guix' command produced by "guix pull"
<civodul>in the future we could imagine a mechanism similar to ld.so.cache
<lle-bout>civodul: thanks will look!
***civodul` is now known as civodul
<soda__hobart>in C, how can i look up a procedure that i loaded and evaluated with scm_c_primitive_load? i have a little test func: (define (say-hi) (display "hi\n")). i tried using scm_c_lookup ("say-hi"), but when i try to use scm_call_0 using the output of scm_c_lookup, i get this error: Wrong type to apply: #<variable 565193c6f130 value: #<procedure say-hi ()>>
<RhodiumToad>so as I understand it, scm_c_lookup returns the variable, not the value
<RhodiumToad>scm_c_private_ref or scm_c_public_ref might be better?
<dsmith-work>ISTR using SCM_VARIABLE_REF
<soda__hobart>oh, that makes sense... i don't see SCM_VARIABLE_REF in the procedure index (dunno if i could use it runtime anyways?)... but for scm_c_public_ref, what would be my module name? is it strictly necessary to define a module or can i just use the evaluation environment created with scm_init_guile?
<RhodiumToad>you could use scm_public_ref(scm_current_module(), scm_from_utf8_symbol(name)) to look up in the current module
<soda__hobart>oh cool. looks like scm_variable_ref (scm_c_lookup ("say-hi")) worked too
<RhodiumToad>yes, that's the same thing under the hood
<soda__hobart>well thanks! i would have been running around in circles for a while
<dsmith-work>SCM_VARIABLE_REF is a macro. No error checking like in the scm_*_ref functions.
<soda__hobart>IM_NOT_YELLING_THIS_IS_A_MACRO
<stis>hey guilers!
<stis>just got python 3.10 match statement working
<stis>in guile prolog
*stis is a match fan
<stis>in guile python it should be
<dsmith-work>stis: Is the new Python match anywhere near close to the match in Rust?
<stis>not so familar with rust. but it is a wecomed addition to python. probably there will be a lot of improvemets to it in the nextreleases
<stis>took me a day to implement it
<stis>it has ... or,and sequence and mapping and class matching
<stis>not =,?
<stis>a guard as well
<stis>not =,? is missing in ice-9 mtch lingo
<stis>much cleaner code in many instances already
<soda__hobart>there's guile prolog?
<stis>soda__hobart: yes
<stis>pretty big and targetting swi-prolog compability but with fun extensions