kurtlawrence / papyrus

(Rust) repl
MIT License
440 stars 14 forks source link

Linux: out# results hidden after call to `println!()` #16

Closed kurtlawrence closed 5 years ago

kurtlawrence commented 5 years ago

eg

papyrus=> 5+6
papyrus [out0]: 11
papyrus=> println!("adf")
papyrus [out1]: ()
papyrus=> 8+9
papyrus [out2]: ()

might be related to #15, the out2 should be 17

kurtlawrence commented 5 years ago

fixed in 0441e5b3c358c3abe83c09b2966f5cad285d477f

This issue was a little subtle to work out. Basically the api function dlopen will keep loaded libraries in memory to avoid continuously allocating memory. It only does not release the library when threadlocal data is hanging around, and it seems println!() is something that does this. Hence to avoid not having the library not updated with a new new() call, the library is renamed and a different lib name is passed to the function. This is very annoying as it has needless fs interactions and a growing fs footprint but what can you do ¯_(ツ)

see: