From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id D2FA6BB83 for ; Tue, 15 Aug 2006 06:56:17 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k7F4uGZW014829 for ; Tue, 15 Aug 2006 06:56:16 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id GAA25249 for ; Tue, 15 Aug 2006 06:56:16 +0200 (MET DST) Received: from smtp1.adl2.internode.on.net (smtp1.adl2.internode.on.net [203.16.214.181]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k7F4uDSt014813 for ; Tue, 15 Aug 2006 06:56:15 +0200 Received: from rosella (ppp7-124.lns1.syd7.internode.on.net [59.167.7.124]) by smtp1.adl2.internode.on.net (8.13.6/8.13.5) with ESMTP id k7F4tvlR080207; Tue, 15 Aug 2006 14:25:58 +0930 (CST) (envelope-from skaller@users.sourceforge.net) Subject: Re: [Caml-list] Weak hashtables & aggressive caching From: skaller To: Jacques Garrigue Cc: matt@gushee.net, caml-list@inria.fr In-Reply-To: <20060815.062335.55488138.garrigue@math.nagoya-u.ac.jp> References: <44E08F95.2070105@gushee.net> <20060815.062335.55488138.garrigue@math.nagoya-u.ac.jp> Content-Type: text/plain Date: Tue, 15 Aug 2006 14:55:56 +1000 Message-Id: <1155617756.29241.25.camel@rosella.wigram> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 44E153F0.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 44E153ED.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; hashtables:01 caching:01 hashtable:01 gdkpixbuf:01 pointers:01 2006:98 interrupts:98 3200:98 wrote:01 wrote:01 sourceforge:01 caml-list:01 exists:01 string:02 string:02 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 On Tue, 2006-08-15 at 06:23 +0900, Jacques Garrigue wrote: > From: Matt Gushee > > > I wrote a LablGTK-based image viewer this past weekend; one of its > > features is an image cache--specifically, a weak hashtable that contains > > values of type string * GdkPixbuf.pixbuf (the string being the file > > name). When a particular image file is requested, it is retrieved from > > the cache if it exists there; otherwise it is loaded from disk (and > > placed in the cache at the same time). This is useful if the user wants > > to quickly look back through a series of images that have already been > > loaded, but it doesn't help with loading images for the first time. > > I wonder how you trigger the GC, to both keep the cache long enough, > and to avoid filling the memory too much, and resulting in lots of > swapping. I'm confused. First, a pixmap doesn't have any pointers in it, so it doesn't need to be scanned by the GC. Second, you'd need a LOT of images to come even close to running out of address space (on a 64 bit machine anyhow :) And third, there would be no swapping, unless you were flicking between the images .. in which case there'd be swapping no matter what. > Considering the difficulties avoid memory overflow, I have thousands of images and I can scan them at full size very fast with GQView .. I can only barely see the drawing happen .. it almost keeps up with the keyboard repeat rate at full screen size .. and that includes *scaling* the images. Mind you .. GQView is extremely quick and it knows when to move on (interrupts rendering when you tell it to view a new image). (this is with a low end nVidia card on an amd64 3200 single core/1GRam) Lets get real here: the difficulties arise editing video, not still pictures. -- John Skaller Felix, successor to C++: http://felix.sf.net