I got into the problem of running out of stack memory using Nokogiri's gem
and parsing complex pages (SystemStackError: stack level too deep
).
I found a couple of threads here that said I need to change the stack size of Rubys VM, but since I am on a Windows 10 laptop, I seem to can't get it to work.
When I open the ruby console and request the variable value I get:
irb> ENV['RUBY_THREAD_VM_STACK_SIZE']
=> nil
when typing this, I do get a value for the stack size (name is slightly different)
irb> RubyVM::DEFAULT_PARAMS
=> {:thread_vm_stack_size=>1048576, :thread_machine_stack_size=>1048576, :fiber_vm_stack_size=>131072, :fiber_machine_stack_size=>524288}
I tryed out to installed the dotenv gem
and set the variables in the .env
file:
RUBY_THREAD_VM_STACK_SIZE = 50000000
THREAD_VM_STACK_SIZE = 50000000
I can now see them in my irb>
as ENV variables, but the RubyVM::DEFAULT_PARAMS
haven't changed.
Any ideas how I can change the VM stack size for my application? Thanks a lot!!