# Is it possible to access memory as a block?

**URL:** <https://www.ruby-forum.com/t/is-it-possible-to-access-memory-as-a-block/192935>\
**Category:** Ruby\
**Created:** [August 8, 2010, 7:10pm UTC](https://www.ruby-forum.com/t/is-it-possible-to-access-memory-as-a-block/192935 "2010-08-08T19:10:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cyberjom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a183cd/32.png) [@cyberjom](https://www.ruby-forum.com/u/cyberjom)\
**Post date:** [August 8, 2010, 7:10pm UTC](https://www.ruby-forum.com/t/is-it-possible-to-access-memory-as-a-block/192935/1 "2010-08-08T19:10:57Z")

</div>

I have a situation to load large amount of data multi-million of data to  
memory for processing.  
It’s memory intensive application. Analysis.

I have found that Hash is too slow, then I try Array but it’s overhead  
of 20 or 40 byte make me run out of memory.

I try to find how to define a pointer to block of memory or create array  
which less overhead.

Is that possible in ruby ?

---

<div class="post-metadata">

**Author:** ![cyberjom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a183cd/32.png) [@cyberjom](https://www.ruby-forum.com/u/cyberjom)\
**Post date:** [August 8, 2010, 7:27pm UTC](https://www.ruby-forum.com/t/is-it-possible-to-access-memory-as-a-block/192935/2 "2010-08-08T19:27:20Z")

</div>

Pinit A. wrote:

> Is that possible in ruby ?  
> What kind of data is it?

Check out mmap:  
[http://rubyforge.org/projects/mmap/](http://rubyforge.org/projects/mmap/)

Also the narray gem and A. Howard’s combination of the two:  
[http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/162769](http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/162769)
