From: joakim@verona.se
To: Tassilo Horn <tassilo@member.fsf.org>
Cc: Miles Bader <miles@gnu.org>, Jashy <nanjunjie@gmail.com>,
Emacs-devel@gnu.org
Subject: Re: Using the ImageMagick backend seems to leak memory
Date: Tue, 11 Jan 2011 15:38:17 +0100 [thread overview]
Message-ID: <m3y66rld46.fsf@verona.se> (raw)
In-Reply-To: <m37hebmsnx.fsf@verona.se> (joakim@verona.se's message of "Tue, 11 Jan 2011 15:17:06 +0100")
joakim@verona.se writes:
> Tassilo Horn <tassilo@member.fsf.org> writes:
Could you try this patch? Seems to help for me
=== modified file 'src/image.c'
*** src/image.c 2011-01-07 22:33:32 +0000
--- src/image.c 2011-01-11 14:30:55 +0000
***************
*** 7566,7571 ****
--- 7566,7572 ----
if (im_image != NULL)
{
image_wand = NewMagickWandFromImage (im_image);
+ DestroyImage(im_image);
status = MagickTrue;
}
else
>
>> Miles Bader <miles@gnu.org> 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
next prev parent reply other threads:[~2011-01-11 14:38 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-06 7:51 Using the ImageMagick backend seems to leak memory Tassilo Horn
2011-01-06 9:02 ` joakim
2011-01-06 10:20 ` Tassilo Horn
2011-01-07 4:17 ` Jashy
2011-01-07 4:59 ` Miles Bader
2011-01-07 6:27 ` Stephen J. Turnbull
2011-01-07 7:25 ` Miles Bader
2011-01-07 8:28 ` Tassilo Horn
2011-01-07 22:39 ` Andreas Schwab
2011-01-10 10:34 ` Tassilo Horn
2011-01-10 13:28 ` Jashy
2011-01-10 13:56 ` Tassilo Horn
2011-01-10 14:36 ` Jashy
2011-01-11 10:14 ` Jashy
2011-01-11 10:59 ` joakim
2011-01-11 14:17 ` joakim
2011-01-11 14:38 ` joakim [this message]
2011-01-11 17:43 ` Tassilo Horn
2011-01-11 18:11 ` joakim
2011-01-11 19:10 ` Tassilo Horn
2011-01-11 19:35 ` joakim
2011-01-11 19:55 ` Tassilo Horn
2011-01-12 1:47 ` Stefan Monnier
2011-01-12 7:37 ` Tassilo Horn
2011-01-10 21:47 ` Tassilo Horn
2011-01-11 8:47 ` Tassilo Horn
2011-01-11 9:35 ` joakim
2011-01-11 9:53 ` Tassilo Horn
2011-01-11 9:54 ` joakim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3y66rld46.fsf@verona.se \
--to=joakim@verona.se \
--cc=Emacs-devel@gnu.org \
--cc=miles@gnu.org \
--cc=nanjunjie@gmail.com \
--cc=tassilo@member.fsf.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).