# GIO: Anyone have any suggestions on how to implement GMemoryOutputStream?

**URL:** <https://www.ruby-forum.com/t/gio-anyone-have-any-suggestions-on-how-to-implement-gmemoryoutputstream/163742>\
**Category:** Ruby-Gnome 2\
**Created:** [March 24, 2009, 3:13pm UTC](https://www.ruby-forum.com/t/gio-anyone-have-any-suggestions-on-how-to-implement-gmemoryoutputstream/163742 "2009-03-24T15:13:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nikolai\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/df705f/32.png) [@Nikolai\_W](https://www.ruby-forum.com/u/Nikolai_W)\
**Post date:** [March 24, 2009, 3:13pm UTC](https://www.ruby-forum.com/t/gio-anyone-have-any-suggestions-on-how-to-implement-gmemoryoutputstream/163742/1 "2009-03-24T15:13:08Z")

</div>

How should I implement GMemoryOutputStream?

> **[Gio-2.0](https://docs.gtk.org/gio/)**
>
> Reference for Gio-2.0

I want to be able to realloc it and such and it would also be sweet if  
getting the data doesn’t alloc a new Ruby string. But how do I do all  
this safely? I’m probably only confusing myself, but I’d appreciate  
any guidance available.

Thanks.

---

<div class="post-metadata">

**Author:** ![Nikolai\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/df705f/32.png) [@Nikolai\_W](https://www.ruby-forum.com/u/Nikolai_W)\
**Post date:** [March 26, 2009, 2:48pm UTC](https://www.ruby-forum.com/t/gio-anyone-have-any-suggestions-on-how-to-implement-gmemoryoutputstream/163742/2 "2009-03-26T14:48:46Z")

</div>

Hi,

In [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
“[ruby-gnome2-devel-en] GIO: Anyone have any suggestions on how to  
implement GMemoryOutputStream?” on Tue, 24 Mar 2009 15:11:49 +0100,  
Nikolai W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> How should I implement GMemoryOutputStream?
> 
> [Learn GNOME](http://library.gnome.org/devel/gio/stable/GMemoryOutputStream.html)
> 
> I want to be able to realloc it and such and it would also be sweet if  
> getting the data doesn’t alloc a new Ruby string. But how do I do all  
> this safely? Iâ€™m probably only confusing myself, but Iâ€™d appreciate  
> any guidance available.

I think that we doesn’t need to implement  
GMemoery{Input,Output}Stream. We should implement  
RBGMemory{Input,Output}Stream and bind them instead.

## Thanks,

kou
