emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Memory leaks in font objects


From: Stefan Monnier
Subject: Re: Memory leaks in font objects
Date: Thu, 24 Oct 2013 20:41:31 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

>> Oddly enough, I'm not sure it's a leak.  Here's the result of my test:
>> 
>> VM   RSS
>> initial  204    24
>> after 1  522   290
>> after 2  539   305
>> after 3  542   308
>> after 4  542   308
>> 
>> So it's more like "once malloced, the memory can be reused by Emacs, but
>> not by another process because we never return it to the OS".

> IIUC no :-(. I tried the following:

You misunderstood: I did not say that those megabytes are available
to malloc.  I just pointed out that it's a similar phenomenon to the one
that takes place with malloc.

> But, if you need to allocate something else, you will need
> more memory.

But the objects are still usable: there is still a pointer to them
somewhere and some sequence of events can bring Emacs to a state where
those objects are used again.  So it is not strictly speaking a leak, in
my book.

Also, I'm curious how you bumped into this problem.  Was it by looking
at the code, or was it in "real life use", or in some test you happened
to be running?

The fact that the wasted memory doesn't grow indefinitely, and only
grows with the fonts actually used, makes me think that it shouldn't be
a problem in real life usage.

>> What the difference between "close" and "finalize"?
> Nothing except "close" is a part of existing interface which I don't want
> to change (at this moment at least), and requires extra frame argument.

So it'd be better to merge the two.


        Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]