help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Question about memory usage


From: Stefan Monnier
Subject: Re: Question about memory usage
Date: Wed, 04 Apr 2018 17:45:37 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

>> >> But shouldn't Emacs reuse the memory from previous loop iteration 
>> >> instead of allocating it?
>> > That depends on the heap fragmentation and the efficiency of the
>> > memory allocating functions to deal with fragmentation.
>> The elements of buffer-undo-list in this case are just cons cells (and
>> immediate integers and nil), IIUC so I don't see why fragmentation would
>> get in the way: the previous cons-cell of the buffer-undo-list of the
>> previous iterations, reclaimed by the GC, should be readily reusable.
> Cons cells are GCed only when enough of them were consed.

They get GC'd when the GC is run.  Yes, the GC won't be invoked at each
iteration, but that shouldn't affect the long-term trend.  At least
I don't see how it can explain the growth that the OP describes: it can
explain a slightly larger footprint, but not a continued growth.


        Stefan




reply via email to

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