# Questions about rb\_iv\_set/get

**URL:** <https://www.ruby-forum.com/t/questions-about-rb-iv-set-get/67136>\
**Category:** Ruby\
**Created:** [August 31, 2006, 11:47pm UTC](https://www.ruby-forum.com/t/questions-about-rb-iv-set-get/67136 "2006-08-31T23:47:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [August 31, 2006, 11:47pm UTC](https://www.ruby-forum.com/t/questions-about-rb-iv-set-get/67136/1 "2006-08-31T23:47:19Z")

</div>

i do have some questions about rb\_iv\_set/get in order to know if i must  
\*\* OR NOT \*\* free mem allocation relevant to VALUEs passed to rb\_iv\_set  
?

are only pointers stored ore copies of strings ?

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [August 31, 2006, 11:53pm UTC](https://www.ruby-forum.com/t/questions-about-rb-iv-set-get/67136/2 "2006-08-31T23:53:19Z")

</div>

On 8/31/06, Une bévue [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> i do have some questions about rb\_iv\_set/get in order to know if i must  
> \*\* OR NOT \*\* free mem allocation relevant to VALUEs passed to rb\_iv\_set  
> ?
> 
> are only pointers stored ore copies of strings ?

I’m afraid I can’t help you with your question, but I can help you get  
more answers. It’s a simple thing, just don’t post with the broken  
[EXTRA TAGS THAT MAKE YOUR SUBJECT HARD TO READ] subject  
line.

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [August 31, 2006, 11:59pm UTC](https://www.ruby-forum.com/t/questions-about-rb-iv-set-get/67136/3 "2006-08-31T23:59:19Z")

</div>

Une bévue wrote:

> i do have some questions about rb\_iv\_set/get in order to know if i must  
> \*\* OR NOT \*\* free mem allocation relevant to VALUEs passed to rb\_iv\_set  
> ?
> 
> are only pointers stored ore copies of strings ?

Assuming you’re using one of the rb\_str\_new family of functions to  
create Ruby String objects from C strings, Ruby makes a copy of the C  
string in Ruby-managed memory. In general Ruby objects are always in  
Ruby-managed memory unless you’re wrapping one of your own C structures  
into a Ruby object with Data\_Wrap\_Struct.

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [September 1, 2006, 12:09pm UTC](https://www.ruby-forum.com/t/questions-about-rb-iv-set-get/67136/4 "2006-09-01T12:09:45Z")

</div>

pat eyler [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I can help you get  
> more answers. It’s a simple thing, just don’t post with the broken  
> [EXTRA TAGS THAT MAKE YOUR SUBJECT HARD TO READ] subject  
> line.

what are those exactly ? the “[C ext 2 Ruby]” : for my point of view it  
is to advert people this thread speaks about “C ext 2 Ruby”, not all are  
interested…

or, is it for the “/” of “rb\_iv\_set/get” ???

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [September 1, 2006, 12:27pm UTC](https://www.ruby-forum.com/t/questions-about-rb-iv-set-get/67136/5 "2006-09-01T12:27:54Z")

</div>

Timothy H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Assuming you’re using one of the rb\_str\_new family of functions to  
> create Ruby String objects from C strings, Ruby makes a copy of the C  
> string in Ruby-managed memory. In general Ruby objects are always in  
> Ruby-managed memory unless you’re wrapping one of your own C structures  
> into a Ruby object with Data\_Wrap\_Struct.

ok, fine, thanks, for this precise answer !
