# 'failed to allocate memory' with Mp3Info module

**URL:** <https://www.ruby-forum.com/t/failed-to-allocate-memory-with-mp3info-module/55566>\
**Category:** Ruby\
**Created:** [March 22, 2006, 4:27am UTC](https://www.ruby-forum.com/t/failed-to-allocate-memory-with-mp3info-module/55566 "2006-03-22T04:27:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![firejdl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/7feea3/32.png) [@firejdl](https://www.ruby-forum.com/u/firejdl)\
**Post date:** [March 22, 2006, 4:27am UTC](https://www.ruby-forum.com/t/failed-to-allocate-memory-with-mp3info-module/55566/1 "2006-03-22T04:27:17Z")

</div>

Hey all:

I’m pretty new to Ruby [this is my second script], but I’m trying to  
write a little playlist generator script to scan a few directories every  
once in a while [probably in a cron job], and update a .m3u playlist  
based on what it finds. I like having info in my playlist so it loads  
automatically with the playlist, so I’m trying to use the Mp3Info  
module. I’ve got my list of files in an array called files. Here’s the  
code I’m using to test things out:

i = 0  
files.each do |f|  
Mp3Info.open(f) do |info|  
puts f  
i += 1  
end  
end

i is just to see how far it’s getting, and puts f is just to see what  
the particular song is.

It runs just fine, up to i=32. At that point, it errors out, with:  
/usr/lib64/ruby/gems/1.8/gems/ruby-mp3info-0.5/lib/mp3info/id3v2.rb:280:in  
`read': failed to allocate memory (NoMemoryError) from /usr/lib64/ruby/gems/1.8/gems/ruby-mp3info-0.5/lib/mp3info/id3v2.rb:280:in `add\_value\_to\_tag2’  
from  
/usr/lib64/ruby/gems/1.8/gems/ruby-mp3info-0.5/lib/mp3info/id3v2.rb:231:in  
`read_id3v2_3_frames' from /usr/lib64/ruby/gems/1.8/gems/ruby-mp3info-0.5/lib/mp3info/id3v2.rb:220:in `read\_id3v2\_3\_frames’  
from  
/usr/lib64/ruby/gems/1.8/gems/ruby-mp3info-0.5/lib/mp3info/id3v2.rb:135:in  
`from_io' from /usr/lib64/ruby/gems/1.8/gems/ruby-mp3info-0.5/lib/mp3info.rb:420:in `parse\_tags’  
from  
/usr/lib64/ruby/gems/1.8/gems/ruby-mp3info-0.5/lib/mp3info.rb:179:in  
`initialize' from /usr/lib64/ruby/gems/1.8/gems/ruby-mp3info-0.5/lib/mp3info.rb:279:in `open’  
from ./playlistgen.rb:48  
from ./playlistgen.rb:47

Am I doing things wrong? Or is it just running out of memory? If it’s  
the latter, is there any way to expand the amount of memory for  
Ruby/Mp3Info to use?

All I really want to do is get the song length, artist and title…is  
there any better way to do it?

Thanks!  
~Joey

PS. I’m using Ruby 1.8.3 and Mp3Info 0.5 on AMD64 with the patch at  
[http://rubyforge.org/tracker/index.php?func=detail&aid=3157&group\_id=62&atid=325](http://rubyforge.org/tracker/index.php?func=detail&aid=3157&group_id=62&atid=325)
