Version française
Home     About     Download     Resources     Contact us    
Browse thread
Can GC be BLOCKed?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Philippe Wang <lists@p...>
Subject: Re: [Caml-list] Can GC be BLOCKed?
Hi.

You can't try to use the thread system to do something like that.

There is a global mutex with OCaml threads !
So a program written in OCaml will not be faster by using threads...

And guess what ? The global mutex does exist because of the existence of 
the GC. And the GC is not threaded...

Well, if ever you manage to do what you said, please let me know.
(If I have well understood your plan, it's clearly impossible)

-- 
  Philippe Wang

Dmitry Bely a écrit :
> On 12/1/06, Richard Jones <rich@annexia.org> wrote:
> 
>> I've only seen two cases where I'd want to stop the GC from running:
>> (1) During quasi real-time operations (eg. a single frame in a game) --
>> this can be solved by making the heap large enough and running the GC
>> at scheduled points.  (2) When the heap is larger than physical RAM --
>> this is solved using our 'Ancient' module.
> 
> I have a main program in C that periodically calls an OCaml function
> and expects the (near) real time response. So I'd like to avoid gc
> inside that function. My current plan is to have another OCaml thread
> that is unfrozen just before returning results to C and does the minor
> (or major - how to decide which one?) garbage collection. Will it
> work?
> 
> - Dmitry Bely