Hey, how often the garbage collector runs?
When all the memory becomes full?
Or there is a pre-defined interval?
It basically runs when a certain amount of memory is used - see
malloc_increase and malloc_limit in gc.c. Also, if malloc() fails or
attempts to open a file fail do to memory limitations the gc will be
run.
And, do you have some links about the the Ruby mark-and-sweep type of
garbage?
While I lack the skill to go source diving, I too am interested in more
info about the gc.
We use conservative gc [talk:102873], ok
So, can one help gc?
e.g. if an Array or Hash is no longer needed, does an Array.clear or
Hash.clear actually zero all internal pointers to help/speed up gc?
How much extra memory does every Ruby object allocation take?
Any alignment losses?
Is there e.g. a preallocate for a String - if I know it'll grow to ~10kb
by using << and I don't want to produce so much temp garbage?
Martin
路路路
"Eust谩quio Rangel de Oliveira Jr." <eustaquiorangel@yahoo.com> wrote:
And, do you have some links about the the Ruby mark-and-sweep type of
garbage?
And, do you have some links about the the Ruby mark-and-sweep type of
garbage?
While I lack the skill to go source diving, I too am interested in more
info about the gc.
We use conservative gc [talk:102873], ok
So, can one help gc?
e.g. if an Array or Hash is no longer needed, does an Array.clear or
Hash.clear actually zero all internal pointers to help/speed up gc?
Yes, that should help, as the mark function would no more mark all the value. But I doubt that would be much of a performance win, because if the array-object goes out of scope (it's no more reachable), it's mark function would no longer be called. So, you would not want to call #clear. But that's just my understanding...
Regards,
Michael
路路路
"Eust谩quio Rangel de Oliveira Jr." <eustaquiorangel@yahoo.com> wrote:
And, do you have some links about the the Ruby mark-and-sweep type of
garbage?
While I lack the skill to go source diving, I too am interested in more
info about the gc.
We use conservative gc [talk:102873], ok
So, can one help gc?
e.g. if an Array or Hash is no longer needed, does an Array.clear or
Hash.clear actually zero all internal pointers to help/speed up gc?
Yes, that should help, as the mark function would no more mark all the
value. But I doubt that would be much of a performance win, because if
the array-object goes out of scope (it's no more reachable), it's mark
function would no longer be called. So, you would not want to call #clear. But that's just my understanding...
This would only help if there is something on the stack that looks
like an address to this array object. The chance for this is very low
and so the performance win. With the Boehm-Weisser GC i a measurable
memory reduction (~20%) by doing this for eiffel. But Boehm-Weisser
scans everything conservative and not only the heap like ruby.
路路路
"Eust谩quio Rangel de Oliveira Jr." <eustaquiorangel@yahoo.com> wrote:
--
Best regards, emailto: scholz at scriptolutions dot com
Lothar Scholz http://www.ruby-ide.com
CTO Scriptolutions Ruby, PHP, Python IDE 's
And, do you have some links about the the Ruby mark-and-sweep type of
garbage?
While I lack the skill to go source diving, I too am interested in more
info about the gc.
We use conservative gc [talk:102873], ok
So, can one help gc?
e.g. if an Array or Hash is no longer needed, does an Array.clear or
Hash.clear actually zero all internal pointers to help/speed up gc?
> Yes, that should help, as the mark function would no more mark all the
> value. But I doubt that would be much of a performance win, because if
> the array-object goes out of scope (it's no more reachable), it's mark
> function would no longer be called. So, you would not want to call
> #clear. But that's just my understanding...
This would only help if there is something on the stack that looks
like an address to this array object. The chance for this is very low
and so the performance win. With the Boehm-Weisser GC i a measurable
memory reduction (~20%) by doing this for eiffel. But Boehm-Weisser
scans everything conservative and not only the heap like ruby.
Hm, my understanding of Ruby's GC is that it scans the stack conservative (meaning that all values on the stack that look like references to memory are handled as references), but not the heap (how could you conservativly scan the heap?). But probably I misunderstood you.
And my final conclusion was that it does not help much, if any, despite my initial "Yes"
Regards,
Michael
路路路
"Eust谩quio Rangel de Oliveira Jr." <eustaquiorangel@yahoo.com> wrote:
memory reduction (~20%) by doing this for eiffel. But Boehm-Weisser
scans everything conservative and not only the heap like ruby.
Hm, my understanding of Ruby's GC is that it scans the stack
conservative (meaning that all values on the stack that look like
references to memory are handled as references), but not the heap (how
could you conservativly scan the heap?). But probably I misunderstood you.
Yes. It was a typo i meant "not only the stack like ruby".
Sorry for the confusion.
路路路
--
Best regards, emailto: scholz at scriptolutions dot com
Lothar Scholz http://www.ruby-ide.com
CTO Scriptolutions Ruby, PHP, Python IDE 's