Questions tagged [mri]

Matz's Ruby Interpreter or Ruby MRI (also called CRuby) is the reference implementation of the Ruby programming language named after Ruby creator Yukihiro Matsumoto ("Matz"). Until the specification of the Ruby language in 2011, the MRI implementation was considered the de facto reference.

103 questions
21
votes
1 answer

Why doesn't this Ruby program return off heap memory to the operating system?

I am trying to understand when memory allocated off the Ruby heap gets returned to the operating system. I understand that Ruby never returns memory allocated to it's heap but I am still not sure about the behaviour of off heap memory. i.e. those…
Adam
  • 223
  • 1
  • 7
7
votes
3 answers

Are there still benefits to running JRuby vs. the latest MRI with Puma?

I'm considering updating our ruby interpreter to JRuby, it's been quite a headache because we've had to remove any 2.x specific syntax from our app and resort to ruby 1.9.3 compatibility. Which isn't the end of the world. When it came time to run…
JP Silvashy
  • 46,977
  • 48
  • 149
  • 227
5
votes
2 answers

How do I tell which Ruby interpreter I'm using?

I've seen this thread, but my question is maybe more basic: Given that the response from the accepted answer in that thread[1] is for me, "/Users/username/.rvm/rubies/ruby-2.3.0/bin/ruby", how do I know if that's MRI, JRuby, etc? What would it look…
Arepo
  • 825
  • 1
  • 9
  • 23
4
votes
1 answer

MRI ruby memory acccess characteristics during multithreading

In some hi-level programming environments (java, dotnet), when accessing same memory from multiple threads, you have to explicitly mark it as volatile or synchrnozied, otherwise you could get stale results from some cache or out-of-order values due…
ultrazars
  • 43
  • 4
4
votes
1 answer

Why does ruby require parentheses here?

When I try to do assert_equal { dry: true }, res I get syntax error, unexpected ':', expecting '}' assert_equal { dry: true }, res but assert_equal({ dry: true }, res) works fine. Why is first form not sufficient for ruby to understand…
graywolf
  • 7,092
  • 7
  • 53
  • 77
4
votes
0 answers

Memory leak in Ruby on Rails app as garbage collector activity spikes

Framework: Rails 5.0.0.1 Platform: Heroku Server: Puma, 30 processes with 10 workers each We're seeing an increase in memory once an hour, coinciding with the Ruby garbage collector as can be seen in the screenshot linked to below. The number of…
Carl
  • 41
  • 3
4
votes
1 answer

MRI ruby threading and performance

My first question on SO, but I've lurked for a long time now so you'll have to forgive me if I've broken any rules or posted a rubbish question. I'm trying to get a better understanding of threading and I decided to test MRI and see how it performs…
Jamie Pirie
  • 150
  • 1
  • 8
3
votes
2 answers

Loading a Nifti through Nibabel and using the shape function

I have a nifti file 1.nii.gz Now, i never dealt with nifti files. So, just opening it using this software i realized that a nii.gz is a sort of container that contains 3 arrays of 2d pictures. In fact, if i scroll the mouse i can see 448 2d…
AleWolf
  • 133
  • 1
  • 6
3
votes
1 answer

Aligning nifti files with different shape and q_offset values in header

I have a whole-body MRI scans with the header below: { dim : [ 3 320 260 96 1 0 0 0] pixdim : [1. 1.40625 1.40625 3. 0.00436 0. 0. 0. ] qoffset_x : -216.09375 qoffset_y :…
Jyotirmay
  • 1,533
  • 3
  • 21
  • 41
3
votes
1 answer

Change entire images slices of NIFTI in Python 3.7

I'm actually work on MRI images using Python. The image format is the NIFTI format I get how to visualise slices on x, y or z axe, but now, I want tu use Sobel filtering on each of them and create a new NIFTI image with those slices. For that: I…
Batfly
  • 33
  • 5
3
votes
2 answers

Is there valid Ruby syntax for as-patterns in parameters like `[[1, 2]].map {|xy@(x, y)| [xy, x + y]}`?

Given that the following currently works in Ruby like a very limited version of Haskell's constructor pattern matching: [[1,[2,3]]].map {|(x, (y, z))| x + y * z} #=> [7] I wonder if it also supports a syntax for "as-patterns" (what Haskell calls…
JoL
  • 1,017
  • 10
  • 15
3
votes
1 answer

What are examples of typical workloads where MRI outperforms JRuby?

I have a Ruby webservice of which I recently checked whether using JRuby (9.1.17.0, OpenJDK 1.8) would improve the performance relative to the current use of MRI (2.5.0). I expected that might be the case, because the performance bottleneck is the…
Confusion
  • 16,256
  • 8
  • 46
  • 71
3
votes
1 answer

ruby requests more memory when there are plenty free heap slots

We have a server running Sidekiq 4.2.9 rails 4.2.8 MRI 2.1.9 This server periodically produce some amount of importing from external API's, perform some calculations on them and save these values to the database. About 3 weeks ago server started…
3
votes
1 answer

How Ruby benchmark calculates total cpu time inside a thread

N.times { Thread.new { puts Benchmark.measure { /* code */ } } } Does the benchmark show the time actually spent executing the code in the thread? Or does it show the total time the ruby interpreter has been running on any thread while the thread…
collimarco
  • 34,231
  • 36
  • 108
  • 142
3
votes
1 answer

Ruby How we can unfreeze the string using pointer

I was going through a blog and found following code snippet: require 'fiddle' str = 'water'.freeze str.frozen? # true memory_address = str.object_id * 2 Fiddle::Pointer.new(memory_address)[1] &= ~8 str.frozen? # false Can anyone explain, I…
Hardik
  • 3,815
  • 3
  • 35
  • 45
1
2 3 4 5 6 7