Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > rb_str_new2

Reply
Thread Tools

rb_str_new2

 
 
Hadmut Danisch
Guest
Posts: n/a
 
      04-10-2004
Hi,

if I use rb_str_new2(something) to return a string value from within
a C function, do I have to free something after that or is something
used within the resulting ruby object?

regards
Hadmut
 
Reply With Quote
 
 
 
 
Tim Hunter
Guest
Posts: n/a
 
      04-10-2004
On Sat, 10 Apr 2004 18:16:04 +0200, Hadmut Danisch wrote:

> Hi,
>
> if I use rb_str_new2(something) to return a string value from within a C
> function, do I have to free something after that or is something used
> within the resulting ruby object?
>
> regards
> Hadmut


GC will clean it up for you after you're finished with it (that is, when
nothing refers to it any longer).

 
Reply With Quote
 
 
 
 
ts
Guest
Posts: n/a
 
      04-10-2004
>>>>> "H" == Hadmut Danisch <(E-Mail Removed)> writes:

H> if I use rb_str_new2(something) to return a string value from within
H> a C function, do I have to free something after that or is something
H> used within the resulting ruby object?

rb_str_new2(something) duplicate `something' otherwise it will not
possible to write

VALUE tt(VALUE obj)
{
return rb_str_new2("aa");
}



Guy Decoux



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
crash of extension on rb_str_new2 newbie Ruby 6 11-09-2005 01:52 AM
rb_str_new2, malloc, free - core dump Daniel Berger Ruby 1 03-03-2005 10:16 PM



Advertisments