This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Persistent malloc


> We are going to remove the MORECORE hook soon.

If that's because it seems odd for the main heap to work differently from
the others, then I see the point. But before the excellent multiple-heaps
thing came along, MORECORE was a pretty good idea. Is there a plan to
deploy something with the same virtues?

It was clever of them at the time to see that malloc comprises a whole lot
of tricky free-chunk juggling that was likely to develop into a very
detailed science, but that such an algorithm applies to ANY linear resource
that gets extended from one end. So it would be a shame to take all that
science and strongly couple it to just one kind of linear resource. The
fact that I could make the heap persistent with so little work is testimony
to that foresight, and if the plan for the future is that people have to
more-or-less copy-paste malloc.c, well that would be a step backwards in my
mind. Nevertheless, polishing away the difference between the main and
subsequent arenas does make sense.

I guess what you have planned for the future is a pure mmap-based solution,
and in that case it would seem even easier to do what I did cos I'm using
mmap as well. Now the only difference is that I have a file under the mmap
and would like to flush it from time to time. As long as I get told which
heap it is, I'd be happy to have multiple files for multiple heaps.

Is that what you all had in mind, or are you just dropping the reasons why
MORECORE was invented?

Adrian.



On 8 November 2017 at 05:52, Florian Weimer <fweimer@redhat.com> wrote:

> On 11/07/2017 09:25 PM, Carlos O'Donell wrote:
>
>> I just managed to make a persistent malloc by replacing MORECORE. My init
>> routine opens a file and maps it to a huge space at a fixed address, then
>> I
>> just ftruncate the file when somebody asks my MORECORE for more:
>>
>
> We are going to remove the MORECORE hook soon.  Newly compiled binaries
> will no longer call it.
>
> You need to provide your own malloc if you want to change this behavior:
>
> <https://www.gnu.org/software/libc/manual/html_node/Replacing-malloc.html>
>
> Thanks,
> Florian
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]