[#61424] [REJECT?] xmalloc/xfree: reduce atomic ops w/ thread-locals — Eric Wong <normalperson@...>

I'm unsure about this. I _hate_ the extra branches this adds;

13 messages 2014/03/12

[ruby-core:61620] Re: [ruby-cvs:52516] ko1:r45370 (trunk): * gc.c (objspace_malloc_increase): should not invoke

From: Eric Wong <normalperson@...>
Date: 2014-03-21 08:43:07 UTC
List: ruby-core #61620
ko1@ruby-lang.org wrote:
>     * gc.c (objspace_malloc_increase): should not invoke
>       garbage_collect_with_gvl() here on non-ruby threads.
>       Should just ignore the malloc_increase.
>       This issue is pointed by Eric Wong [ruby-core:61519].

Also, how about using a objspace->want_gc_soon flag in these situations.

I have also been thinking about having Ruby detect best places to GC
and defer GC until those points:

1) when the stack is shallow
2) when a thread is about to sleep

But multiple threads makes it hard to predict the best points.

Maybe objspace should track allocations per-thread, not globally.
Threads which allocate most would also run GC most;
ideally when 1) and 2) are true.

In This Thread

Prev Next