ChanServ changed the topic of #crystal-lang to: The Crystal programming language | | Fund Crystal's development: | GH: | Docs: | Gitter:
Guest49 has joined #crystal-lang
<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
<Guest49> my novel approach is
<Guest49> which works, but just seems, hacky
<FromGitter> <Blacksmoke16> probably fine
<Guest49> id assume it would get optimised away anyways and that it just looks ugly
<FromGitter> <Blacksmoke16> `test.chars.rotate(2).join` would also work, but what you have is prob more efficient
<FromGitter> <Blacksmoke16> `rotate!`*
<Guest49> hmm yea i didnt think to check if array had a rotate method. ill probably benchmark them both later
<Guest49> thanks
Guest49 has quit [Quit: Client closed]
<FromGitter> <HertzDevil>
ur5us__ has quit [Ping timeout: 258 seconds]
ur5us__ has joined #crystal-lang
ua_ has quit [Excess Flood]
ua_ has joined #crystal-lang
ua_ has quit [Excess Flood]
ua_ has joined #crystal-lang
debayer has joined #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> <> 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)
debayer has quit [Quit: Textual IRC Client:]
dch has joined #crystal-lang
<dch> hey, I'm a FreeBSD user trying to build a port for avalancheMQ.
<dch> it appears that crystal does things we are not expecting it to, trying to find a compatible SSL library, (crystal v1.1.1).
<dch> and our FreeBSD bug report for this
<FromGitter> <> 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, 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:
<dch> thank you for your invidious work! *so much appreciation*
notzmv has joined #crystal-lang
<FromGitter> <naqvis> > *<SamantazFox>* if I do, 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: ⏎ ⏎ 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
deavmi_ has quit [Ping timeout: 258 seconds]
deavmi has joined #crystal-lang
deavmi has quit [Ping timeout: 258 seconds]
deavmi has joined #crystal-lang
[jamez] has quit [Ping timeout: 258 seconds]
[jamez] has joined #crystal-lang
ur5us__ has joined #crystal-lang
<SamantazFox> yxhuvud: yeah, that's possible
<riza> SamantazFox: Invidious?
ur5us__ has quit [Ping timeout: 258 seconds]
<raz> (capture logging in spec and dump on error)
<SamantazFox> FromGitter: Thank, I'll try that :)
<FromGitter> SamantazFox, I'm a bot, *bleep, bloop*. I relay messages between here and
<SamantazFox> @naqvis then ^^
<SamantazFox> And no, I haven't tried valgrind, as those issues tend to happen when *many* users connect