<Guest49>
hi all. i have a simple problem which is solved, but I am just seeing if there are any cleaner solutions. given a string move the first 2 characters to the end of the string. in ruby land i would use String#rotate, but i can't seem to find a equivalent in crustal
<FromGitter>
<Blacksmoke16> interesting use case
<FromGitter>
<Blacksmoke16> but no, that method doesnt exist in crystal lang
ur5us__ has quit [Remote host closed the connection]
ur5us__ has joined #crystal-lang
ur5us__ has quit [Ping timeout: 272 seconds]
wolfshappen_ has quit [Ping timeout: 258 seconds]
deavmi_ has joined #crystal-lang
deavmi has quit [Read error: Connection reset by peer]
<raz>
hmm, in spec, is there a var that points me to the root of the spec/ folder or the project root
<raz>
counting the dots in `require "../../../../../spec_helper"` is getting kinda old, esp. when moving stuff around :..(
<raz>
brrr ok, that's getting ugly. wish spec just had a `-r` to pre-require stuff hm.
<raz>
guess i'll continue counting the dots for now 🧮
ur5us__ has joined #crystal-lang
elf_fortrez has joined #crystal-lang
ur5us__ has quit [Ping timeout: 258 seconds]
<FromGitter>
<Blacksmoke16> That's quite a nested structure you got going there
<FromGitter>
<erdnaxeli:cervoi.se> raz : I have a spec_helper file in every folder, requiring the one in the parent folder, so that's easier
<raz>
hmm yea. i may consider that. but not a fan of the boilerplate pollution. (it's a small thing - but every codebase is the sum of its small things ;))
<raz>
re smoke: well, it's not that nested in reality but the protobuf stuff takes it ~3 levels deep easily.
<jhass[m]>
I mean I would support crystal spec adding the root folder of the commandline arguments or `spec` by default to CRYSTAL_PATH. In ruby land rspec does the same afaik
<raz>
indeed. hm. i suppose CRYSTAL_PATH is const and can't be patched with a macro? (i've never tried)
<FromGitter>
<manveru:matrix.org> dch: you could try passing `--link-flags '-L/path/to/your/ssl/lib'`
<dch>
hey, a big constraint on FreeBSD is that choice of SSL is up to user. we have:
<dch>
- base (inbuilt to FreeBSD, probably approx 1.1.0 atm) which doesn't have a pkg-config output (because its not a package)
<dch>
- openssl, boringssl, libressl (which all come with pkg-config output)
<dch>
but normally we would build ports against OpenSSL in base system (and therefore without a pkg-config available)
<dch>
and crystal is falling back to "0.0.0" as default, and not "1.1.1" which would be the correct choice for base OpenSSL
<SamantazFox>
Hello here
<SamantazFox>
I'm one of the devs from Invidious, and I have a few memory management-related questions
<SamantazFox>
I know the difference between structs and classes allocation-wise: the former is allocated on the stack, and the second is allocated in the heap. But how are they cleaned up?
<SamantazFox>
if I do SomeClass.new, when will this GC'd?
<SamantazFox>
We have a *ton* of memory issues, leading to recurrent crahes, and I'd like to solve those.
elf_fortrez has quit [Quit: Client closed]
<SamantazFox>
One of those recent crashes seem to come from the GC itself: https://bpa.st/6UOA
<dch>
thank you for your invidious work! *so much appreciation*
notzmv has joined #crystal-lang
<FromGitter>
<naqvis> > *<SamantazFox>* if I do SomeClass.new, when will this GC'd? ⏎ Technically speaking, objects get incrementally GCed when the go out of scope. If you are seeing huge memory usage, that might be symptom of memory leak.
<FromGitter>
<naqvis> Have you tried using tools like valgrind or similar to do some tracing?
<FromGitter>
<naqvis> > *<SamantazFox>* One of those recent crashes seem to come from the GC itself: https://bpa.st/6UOA ⏎ ⏎ to get GC issue out of scope, i would say try running your code without GC enabled `-Dgc_none` and see if you encounter similar segfaults. Though i guess you might get OOM instead
<FromGitter>
<naqvis> Memory leaks are hard to find without using tools or some logging mechanisms to capture the stats
Guest456 has joined #crystal-lang
Guest456 has quit [Client Quit]
Guest58 has joined #crystal-lang
Guest58 has quit [Client Quit]
<yxhuvud>
also note that structs are copied around, not passed by reference, so it is possible to get lots of copies of really large structs without realizing it
<raz>
hmm crystal has always been good wrt to memory mgmt to me. would also suspect a possible struct (or other) leak