From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: joakim@verona.se Newsgroups: gmane.emacs.devel Subject: Re: Using the ImageMagick backend seems to leak memory Date: Tue, 11 Jan 2011 15:17:06 +0100 Message-ID: References: <87sjx6zczl.fsf@member.fsf.org> <30611405.post@talk.nabble.com> <874o9l86eb.fsf@member.fsf.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1294755453 2261 80.91.229.12 (11 Jan 2011 14:17:33 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 11 Jan 2011 14:17:33 +0000 (UTC) Cc: Emacs-devel@gnu.org, Jashy , Miles Bader To: Tassilo Horn Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jan 11 15:17:27 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Pcf2N-0003hH-MG for ged-emacs-devel@m.gmane.org; Tue, 11 Jan 2011 15:17:27 +0100 Original-Received: from localhost ([127.0.0.1]:58415 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pcf2M-0001Pm-EP for ged-emacs-devel@m.gmane.org; Tue, 11 Jan 2011 09:17:26 -0500 Original-Received: from [140.186.70.92] (port=37502 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pcf2G-0001Pb-Vn for Emacs-devel@gnu.org; Tue, 11 Jan 2011 09:17:21 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pcf2D-0003Gn-Mg for Emacs-devel@gnu.org; Tue, 11 Jan 2011 09:17:20 -0500 Original-Received: from batman.blixtvik.net ([87.96.254.3]:51570) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pcf2D-0003GD-Dh; Tue, 11 Jan 2011 09:17:17 -0500 Original-Received: from www.verona.se (4-208-96-87.cust.blixtvik.se [87.96.208.4]) by batman.blixtvik.net (Postfix) with ESMTP id AD0977F943E; Tue, 11 Jan 2011 15:17:15 +0100 (CET) Original-Received: from localhost.localdomain (unknown [192.168.201.6]) by www.verona.se (Postfix) with ESMTP id E265296B070; Tue, 11 Jan 2011 15:17:06 +0100 (CET) In-Reply-To: <874o9l86eb.fsf@member.fsf.org> (Tassilo Horn's message of "Fri, 07 Jan 2011 09:28:12 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:134445 Archived-At: Tassilo Horn writes: > Miles Bader writes: > >>>> I just noticed that my emacs uses up more than a gigabyte memory. >>>> It is because of doc-view with ImageMagick backend. >>>> >>> I met same issue. >> >> My impression is that in general, ImageMagick does not aim at memory >> efficiency (that's why I don't want to use its libraries for my own >> image I/O needs, event though doing so would be pretty convenient). > > Well, not being memory efficiency and not giving back memory at all is a > minor difference. ;-) > > I've just opened a doc-view page-x.png with ImageMagick's display tool. > The behavior is identical, e.g., it reserves ~30MB per PNG and only > gives back memory when I close the program. So I presume, ImageMagick > has some cache that gets at least cleared when the process is killed. > I'm sure, there's some C function you can call to clear it... > > Looking at the API, there's > > ClearMagickWand() clears resources associated with the wand. > The format of the ClearMagickWand method is: > > void ClearMagickWand(MagickWand *wand) > > A description of each parameter follows: > wand > the magick wand. > > In the emacs sources, that function's never called. So that's probably > the source of the leak. Hmm. We can try. Anyway i asked the IM team: http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=17819 Some other things: - Do you see the issue only when scaling? - Only with PNG? Or also JPG? > Bye, > Tassilo -- Joakim Verona