[#5218] Ruby Book Eng tl, ch1 question — Jon Babcock <jon@...>

13 messages 2000/10/02

[#5404] Object.foo, setters and so on — "Hal E. Fulton" <hal9000@...>

OK, here is what I think I know.

14 messages 2000/10/11

[#5425] Ruby Book Eng. tl, 9.8.11 -- seishitsu ? — Jon Babcock <jon@...>

18 messages 2000/10/11
[#5427] RE: Ruby Book Eng. tl, 9.8.11 -- seishitsu ? — OZAWA -Crouton- Sakuro <crouton@...> 2000/10/11

At Thu, 12 Oct 2000 03:49:46 +0900,

[#5429] Re: Ruby Book Eng. tl, 9.8.11 -- seishitsu ? — Jon Babcock <jon@...> 2000/10/11

Thanks for the input.

[#5432] Re: Ruby Book Eng. tl, 9.8.11 -- seishitsu ? — Yasushi Shoji <yashi@...> 2000/10/11

At Thu, 12 Oct 2000 04:53:41 +0900,

[#5516] Re: Some newbye question — ts <decoux@...>

>>>>> "D" == Davide Marchignoli <marchign@di.unipi.it> writes:

80 messages 2000/10/13
[#5531] Re: Some newbye question — matz@... (Yukihiro Matsumoto) 2000/10/14

Hi,

[#5544] Re: Some newbye question — Davide Marchignoli <marchign@...> 2000/10/15

On Sat, 14 Oct 2000, Yukihiro Matsumoto wrote:

[#5576] Re: local variables (nested, in-block, parameters, etc.) — Dave Thomas <Dave@...> 2000/10/16

matz@zetabits.com (Yukihiro Matsumoto) writes:

[#5617] Re: local variables (nested, in-block, parameters, etc.) — "Brian F. Feldman" <green@...> 2000/10/16

Dave Thomas <Dave@thomases.com> wrote:

[#5705] Dynamic languages, SWOT ? — Hugh Sasse Staff Elec Eng <hgs@...>

There has been discussion on this list/group from time to time about

16 messages 2000/10/20
[#5712] Re: Dynamic languages, SWOT ? — Charles Hixson <charleshixsn@...> 2000/10/20

Hugh Sasse Staff Elec Eng wrote:

[#5882] [RFC] Towards a new synchronisation primitive — hipster <hipster@...4all.nl>

Hello fellow rubyists,

21 messages 2000/10/26

[ruby-talk:5570] Notes about GC

From: Mathieu Bouchard <matju@...>
Date: 2000-10-16 06:16:03 UTC
List: ruby-talk #5570
I wrote the following notes in a msg to Aleksi some weeks ago. They are
about Ruby's GC.  I thought I'd integrate them to gc.c, but I'm changing
some things I didn't think I'd change originally. So I'm posting the notes
here, because they can be useful without necessarily being relevant to the
GC's source code, plus, a lot less people would give feedback to source
code comments :-).

[the following notes have been slightly edited since the original ones]

---

In Ruby, garbage collection is done in two occasions: when the allocation
size counter goes over a given threshold; and when all the active object
pools are used (apart from a "minimum free memory"). In the latter case,
after GC, inactive object pools are activated, and if there are no more
inactive object pools, then a bunch of them are created at once. 

There are four values of interest that affect GC frequency:

	* allocation size counter threshold
	* activation of object pools
	* creation of object pools
	* free memory is below minimum

The problem with Ruby 1.6 (and former versions) is that those four values
are compile-time constants. If we separate ruby execution in two parts (1:
evaluation, 2:GC) this means that garbage collection is done at constant
intervals in evaluation time (on average). However, the amount of time
spent in each GC phase is (on average) proportional to the amount of
allocated objects.

By making the above four values proportional to the amount of currently
allocated cells, you decrease the GC frequency, so total fraction of time
spent on GC should remain constant.

Since allocation of new object pools is done only when the memory is
(nearly) full, there is no risk that a process will make its process size
skyrocket if it is just keeping a small average amount of live objects
with frequent creation/deletion.

The process size should always be a relatively small percentage above the
maximum number of allocated objects at once. 

But strict proportionality does not work: it crashes if some of the base
values are too small. By lowering them as much as possible, Ruby could be
downscaled so that it could run in smaller systems, or most probably, on a
regular system with a large number of small Ruby processes. I did not
experiment in that direction. 

> In any case this is good news, and I can't wait to see how well generative
> GC with your allocation policy will work. As far as I understand all new
> objects will be placed to "new-objects" pool, and if they survive few GCing
> they got a promotion to "old-objects" pool, which is GCed more seldom. 

The performance of a generational GC without my patch would depend on the
policies for sizing the different age categories. Possibly that a
generational GC would remove some of the need for my patch; OTOH, applying
and expanding the proportionality policy (in age category sizes) might
result in even better performance (BUT: I don't have a clue).

> My example program should be quite fast with [generational gc]

* many small programs will see good or tremendous performance increases;

* many other small programs will see no increase or worse;

* Most complex enough programs contain lots of different programs, which
is like an average of a lot of various small programs together. The
emerging pattern should be that the lifetime of an object is 1/rand on
average.  (?) 

Note that I don't know GC very much, I'm mostly applying general knowledge
:-)


matju




In This Thread

Prev Next