From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 95AECBC68 for ; Thu, 26 Oct 2006 15:48:54 +0200 (CEST) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.188]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id k9QDmoK3015507 for ; Thu, 26 Oct 2006 15:48:54 +0200 Received: from [84.58.163.8] (helo=gate.lan.gerd-stolpmann.de) by mrelayeu.kundenserver.de (node=mrelayeu5) with ESMTP (Nemesis), id 0ML25U-1Gd5bF1lG7-00083u; Thu, 26 Oct 2006 15:48:49 +0200 Received: from flakew.lan.gerd-stolpmann.de (fw.lan.gerd-stolpmann.de [192.168.1.1]) by gate.lan.gerd-stolpmann.de (Postfix) with ESMTP id DA49CC0AD; Thu, 26 Oct 2006 15:48:48 +0200 (CEST) Subject: Re: [Caml-list] caml_oldify_local_roots takes 50% of the total runtime From: Gerd Stolpmann To: skaller Cc: Markus Mottl , Hendrik Tews , caml-list@inria.fr In-Reply-To: <1161802911.12050.5.camel@rosella.wigram> References: <17727.34685.561877.977822@tandem.cs.ru.nl> <1161802911.12050.5.camel@rosella.wigram> Content-Type: text/plain Date: Thu, 26 Oct 2006 15:48:47 +0200 Message-Id: <1161870528.20369.27.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 Content-Transfer-Encoding: 7bit X-Provags-ID: kundenserver.de abuse@kundenserver.de login:a6865a839c0178d9aa0ce41878507ea2 X-Miltered: at concorde with ID 4540BCC2.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; oldify:01 runtime:01 gerd:01 stolpmann:01 donnerstag:01 markus:01 mottl:01 interfacing:01 non-trivial:01 workarounds:01 error-prone:01 hash:01 pointer:01 pointers:01 stack:01 Am Donnerstag, den 26.10.2006, 05:01 +1000 schrieb skaller: > On Wed, 2006-10-25 at 14:21 -0400, Markus Mottl wrote: > > > It would be great if the GC could be improved in situations where > > there are many local roots. This is a pretty common problem when > > interfacing non-trivial third party libraries, and the clumsy > > workarounds require writing somewhat error-prone code. > > Just curious .. but why is there *ever* any need for more than > one root? If you need to add a root, why not just add to > an already rooted data structure? Would that solve the problem? > Yes, that solves it. The point is that a normal data structure (e.g. hash table, ...) can be moved to the major heap, so it is only traversed for each major collection. Note also that there are local and global roots. You need local roots for every pointer that is _temporarily_ outside the heap, so yes, you need usually a lot of them. Pointers on the stack are local roots, too. Global roots are for pointers that are outside the heap for a long time. I think these could be handled more efficiently by the GC, e.g. by moving global roots to a second list when the object referenced by the pointer is moved to the major heap. Gerd -- ------------------------------------------------------------ Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany gerd@gerd-stolpmann.de http://www.gerd-stolpmann.de Phone: +49-6151-153855 Fax: +49-6151-997714 ------------------------------------------------------------