[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#38345: 27.0.50; Permanent increase in memory consumption after openi
From: |
Ihor Radchenko |
Subject: |
bug#38345: 27.0.50; Permanent increase in memory consumption after opening images (or pdfs) |
Date: |
Sun, 24 Nov 2019 00:04:17 +0800 |
> memory allocated via malloc AFAIK gets grafted into the program's
> address space, and when it is freed, it is left in the program's
> address space, free to be used by that program for any further
> allocation -- but is not returned to the system. So if you look at
> the program's address space, you will think it only ever grows,
> especially if you allocate a lot of memory before releasing the first
> allocation.
Hmm. Following an article by Dima Kogan [1], it appears to me that free()
should de-allocate memory in the program's address space (or at least
memory drop should be visible in the plot I got, since I used the same
memory debugging tools)
Best,
Ihor
[1]
http://notes.secretsauce.net/notes/2015/10/05_memory-leak-debugging-tools.html
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Ihor Radchenko <yantar92@gmail.com>
>> Cc: 38345@debbugs.gnu.org
>> Date: Sat, 23 Nov 2019 23:18:21 +0800
>>
>> What you say about Emacs not returning memory sounds like very very
>> strange behaviour unless I misunderstand something. Does it mean that if
>> I have emacs running as daemon and open a few hundreds of heavy pdfs
>> during, say, a week, it will keep all the memory allocated for those pdfs
>> (which is several Gb, at least)? If so, I don't think that Emacs should
>> do it.
>
> It depends on how the memory is allocated. Memory allocated for
> buffers gets returned to the OS when those buffers are killed. But
> memory allocated via malloc AFAIK gets grafted into the program's
> address space, and when it is freed, it is left in the program's
> address space, free to be used by that program for any further
> allocation -- but is not returned to the system. So if you look at
> the program's address space, you will think it only ever grows,
> especially if you allocate a lot of memory before releasing the first
> allocation.
>
> At least that's what I think happens on modern platforms.
bug#38345: 27.0.50; Permanent increase in memory consumption after opening images (or pdfs), Eli Zaretskii, 2019/11/25