<vlad87>
Running this program with ruby version 2.7.8 works as I imagined - both calls should print "0" to stdout (considering no allocations are happening in the provided block). However, running it with any ruby version starting from 3.0.7 (may not be the exact one introducing the behavior just what i tested with) I get strange results: first call to
<vlad87>
allocations outputs 1 and then any other future call to it outputs 0 as I initially expected. I get even stranger results with something like:
<vlad87>
<<EOF
<vlad87>
class A end
<vlad87>
p allocations { A.new }
<vlad87>
p allocations { A.new }
<vlad87>
EOF
STASIdownunder has joined #ruby
vlad87 has quit [Client Quit]
STASIdownunder has quit [Read error: Connection reset by peer]
<wbooze>
allocates only once ?
Linux_Kerio has joined #ruby
STASIdownunder has joined #ruby
<o0x1eef>
A.new allocates 4 then 2, that's surprising to me, but I'm not sure you can exclude overhead in those calculations, as in, there might be allocations going on behind the scenes that aren't apparent but contribute to the count.
STASIdownunder has quit [Read error: Connection reset by peer]
<o0x1eef>
So I'd probably treat it similar to a yard stick rather than an exact measurement
GreenResponse has joined #ruby
Guest98 has joined #ruby
Guest98 has quit [Client Quit]
andy-turner has quit [Quit: Leaving]
andy-turner has joined #ruby
user71 has joined #ruby
STASIdownunder has joined #ruby
lutherann has quit [Ping timeout: 260 seconds]
STASIdownunder has quit [Read error: Connection reset by peer]
lutherann has joined #ruby
lutherann has quit [Client Quit]
STASIdownunder has joined #ruby
STASIdownunder has quit [Quit: STASI exists down under]