This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: Suggestion: try_realloc
- From: nisse at lysator dot liu dot se (Niels Möller)
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: libc-help at sourceware dot org, Marco Bodrato <bodrato at mail dot dm dot unipi dot it>, Torbjorn Granlund <tg at gmplib dot org>
- Date: Tue, 26 Feb 2013 18:23:59 +0100
- Subject: Re: Suggestion: try_realloc
- References: <nn4nh0qsgc.fsf@stalhein.lysator.liu.se><512CD7A2.8020509@redhat.com>
Florian Weimer <fweimer@redhat.com> writes:
> On 02/25/2013 05:16 PM, Niels Möller wrote:
>> Essentially, I'd like try_realloc to succeed whenever it can succeed
>> with less work than free + malloc. With the current implementation, that
>> is when the current block can be grown in place, and when it can be
>> grown via remap.
>
> For std::vector, it would be beneficial to have an interface which
> succeeds only if the address doesn't change. I think this would fit
> your needs as well.
I'm not sure about the remap case.
*If* a remap is more efficient than malloc and free (translated to mmap
and munmap), then I'd like try_realloc to succeed in that case and
return the new address. But if remap is slower, try_realloc shouldn't do
it, and if the difference is very small, then it doesn't matter.
Regards,
/Niels
--
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.