rb_str_new2

Discussion in 'Ruby' started by Hadmut Danisch, Apr 10, 2004.

  1. 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
     
    Hadmut Danisch, Apr 10, 2004
    #1
    1. Advertising

  2. Hadmut Danisch

    Tim Hunter Guest

    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).
     
    Tim Hunter, Apr 10, 2004
    #2
    1. Advertising

  3. Hadmut Danisch

    ts Guest

    >>>>> "H" == Hadmut Danisch <> 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
     
    ts, Apr 10, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Daniel Berger

    rb_str_new2, malloc, free - core dump

    Daniel Berger, Mar 3, 2005, in forum: Ruby
    Replies:
    1
    Views:
    302
    Charles Mills
    Mar 3, 2005
  2. newbie
    Replies:
    6
    Views:
    122
    nobuyoshi nakada
    Nov 9, 2005
Loading...

Share This Page