[#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,
[#427] Re: New feature for Ruby?
— Clemens Hintze <c.hintze@...>
1999/07/02
On Fri, 02 Jul 1999, you wrote:
[#428] Re: New feature for Ruby?
— gotoken@... (GOTO Kentaro)
1999/07/03
Hi,
[#429] Re: New feature for Ruby?
— Clemens Hintze <c.hintze@...>
1999/07/03
On Sat, 03 Jul 1999, you wrote:
[#430] Re: New feature for Ruby?
— gotoken@... (GOTO Kentaro)
1999/07/05
Hi,
[#431] Re: New feature for Ruby?
— Clemens Hintze <c.hintze@...>
1999/07/07
On Mon, 05 Jul 1999, you wrote:
[#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:
[#452] Re: Now another totally different ;-)
— gotoken@... (GOTO Kentaro)
1999/07/11
Hi,
[#462] Re: Now another totally different ;-)
— matz@... (Yukihiro Matsumoto)
1999/07/12
Hello, there.
[#464] Re: Now another totally different ;-)
— Clemens Hintze <c.hintze@...>
1999/07/12
On Mon, 12 Jul 1999, you wrote:
[#467] Re: Now another totally different ;-)
— matz@... (Yukihiro Matsumoto)
1999/07/12
Hi,
[#468] Re: Now another totally different ;-)
— gotoken@... (GOTO Kentaro)
1999/07/12
In message "[ruby-talk:00467] Re: Now another totally different ;-)"
[#443] — Michael Hohn <hohn@...>
Hello,
26 messages
1999/07/09
[#444] interactive ruby, debugger
— gotoken@... (GOTO Kentaro)
1999/07/09
Hi Michael,
[#448] Re: interactive ruby, debugger
— "NAKAMURA, Hiroshi" <nakahiro@...>
1999/07/10
Hi,
[#450] Re: interactive ruby, debugger
— Clemens Hintze <c.hintze@...>
1999/07/10
On Sat, 10 Jul 1999, you wrote:
[#490] Some questions concerning GC in Ruby extensions — Clemens Hintze <c.hintze@...>
Hi matz,
6 messages
1999/07/14
[#501] Ruby 1.3.5 — Yukihiro Matsumoto <matz@...>
Ruby 1.3.5 is out, check out:
1 message
1999/07/15
[#519] CGI.rb — "Michael Neumann" <neumann@...>
Hi...
7 messages
1999/07/24
[#526] Another way for this? And a new proposal! — Clemens Hintze <c.hintze@...>
Hi,
6 messages
1999/07/25
[ruby-talk:00491] Ruby's GC (Re: Some questions concerning GC in Ruby extensions)
From:
matz@... (Yukihiro Matsumoto)
Date:
1999-07-14 07:06:55 UTC
List:
ruby-talk #491
Hi,
In message "[ruby-talk:00490] Some questions concerning GC in Ruby extensions"
on 99/07/14, Clemens Hintze <c.hintze@gmx.net> writes:
|Hi matz,
|
|I am currently writing a Ruby extension using C. Now I have some
|questions. May I ask them to you?
Hmm, good questions. I'll separate them into several groups.
This is the first one relating GC.
|In `Data_Wrap_Struct' and `Data_Make_Struct' there are two
|parameters I don't understand at whole. These are `mark' and `free'.
|
| 1. The functions pointed to by these parameters are called from the
| GC, right?
Yes.
| 2. GC calls first `mark' and then `free'? Why?
|
| 3. How will `mark'ed references discard later?
Do you know the mark-and-sweep GC scheme?
It consists of 2 phases: mark phase and sweep phase.
In mark phase, objects are visited recursively starting from several
root objects. All visited objects are marked as live object. The
mark function will be called in this mark phase to detect objects
referred from Data objects.
Then in sweep phase, all unmarked objects are considered as dead.
They are reclaimed by the collector. The free function will be called
to free up the memory block relating the Data object.
| 4. With `free' do you mean the opposite of `malloc' from the
| standard C library? If yes...
Yes.
| 4.a. Why do I need `free'? I had assumed that we have `ALLOC_N'
| and true GC.
ALLOC_N() is just a wrapper for xmalloc(). Unlike Bohem's
conservative GC, Our true GC treats objects only. All the memory
referred from objects are allocated by malloc(); deallocated by free
function called from GC.
| 5. The function `Data_Make_Struct' use `malloc'. Is that our old
| and beloved `malloc' of the standard C library? If yes...
Yes.
| 5.a. Why do we not use `ALLOC_N' here?
See above.
|If a function within my extension use `malloc' to allocate memory, and
|there is no memory available...
|
| 6. What kind of exception would you throw?
When malloc() returns NULL, then the memory allocator invokes GC, then
tries malloc() again. If malloc() still returns NULL after GC, the
memory allocator gives up allocation, raises Fatail error.
See xmalloc() in gc.c for detail.
Hope this helps.
matz.