[#407] New feature for Ruby? — Clemens.Hintze@...

Hi all,

27 messages 1999/07/01
[#413] Re: New feature for Ruby? — matz@... (Yukihiro Matsumoto) 1999/07/01

Hi Clemens,

[#416] Re: New feature for Ruby? — Clemens Hintze <c.hintze@...> 1999/07/01

On Thu, 01 Jul 1999, Yukihiro Matsumoto wrote:

[#418] Re: New feature for Ruby? — gotoken@... (GOTO Kentaro) 1999/07/01

Hi

[#426] Re: New feature for Ruby? — gotoken@... (GOTO Kentaro) 1999/07/02

Hi,

[#440] Now another totally different ;-) — Clemens Hintze <c.hintze@...>

Hi,

21 messages 1999/07/09
[#441] Re: Now another totally different ;-) — matz@... (Yukihiro Matsumoto) 1999/07/09

Hi,

[#442] Re: Now another totally different ;-) — Clemens Hintze <c.hintze@...> 1999/07/09

On Fri, 09 Jul 1999, you wrote:

[#443] — Michael Hohn <hohn@...>

Hello,

26 messages 1999/07/09
[#444] interactive ruby, debugger — gotoken@... (GOTO Kentaro) 1999/07/09

Hi Michael,

[ruby-talk:00499] Re: Ruby's GC (Re: Some questions concerning GC in Ruby extensions)

From: Shugo Maeda <shugo@...>
Date: 1999-07-15 01:27:47 UTC
List: ruby-talk #499
Hi,

At Wed, 14 Jul 1999 20:39:21 +0200,
Clemens Hintze <c.hintze@gmx.net> wrote:
> I have assumed, you use the Bohem's GC. Why not?

Bohem's GC _was_ unstable....

> Does the GC only collect data, which are some kind of Ruby object?

Yes, and I think it's nice.
# Because Ruby's GC is not GC for C language.

>    while (<some condition>) {
>       buf = ALLOC_N(char, 12);
>       strcpy(buf, "hello");
>       gc_start();
>    }

You should call free() to avoid memory leak:-(

> Is here the memory pointed by `buf' safe? Or will I need a
> function like that: 
> 
>    void mark_buf(strp)
>       struct string *strp;
>    {
>       rb_gc_mark(strp->buf);
>    }

There is no need to mark buf because buf is not a Ruby object:-)

> Will the memory pointed by `buf' be deleted during GC? Or have I to
> implement a `free_string' method like that:
> 
>    void free_string(strp)
>       struct string *strp;
>    {
>       free(strp->buf);
>       strp->size = 0;     /* Okay! paranoid. */
>    }

Yes.
# And you should free strp itself too.

> >memory allocator gives up allocation, raises Fatail error.
> 
> But that happens only if I use `xmalloc'. My question was, if my
> extension use `malloc' directly, and report back to me, that there
> was no enough memory available. Should I raise an fatal error then,
> or what kind of error you would raise?

Maybe, you should raise a fatal error.
# But why don't you use xmalloc()?

Shugo

In This Thread