0

What is the memory limit for SoloLearn in ruby?

how many elements long can an array be?

2nd Jun 2017, 9:47 PM
Patrick Fulghum
Patrick Fulghum - avatar
3 Answers
0
Just curious why you need it?
5th Jun 2017, 6:47 PM
Milind
Milind - avatar
0
I thought it was absurdly low, but i realize now i was blundering. I was trying to create an array of 64 elements. That is easily done in SoloLearn. I posted this question because I thought SoloLearn was stopping me but it was just my syntax!
5th Jun 2017, 6:56 PM
Patrick Fulghum
Patrick Fulghum - avatar
0
I am a newbie with Ruby but I tried to write a simple code to see if it would give me a hint. And I basically manually changed the number of elements to be allocated. I found out that approximately 591000 elements can be pre-allocated, after which the memory limit error is displayed. NOTE: The missing piece of information is how much memory is allocated per item in the Array. So here is the code ----------- size = 591000 arr = Array.new(size) puts "Array Length = #{arr.size}"
5th Jun 2017, 7:49 PM
Milind
Milind - avatar