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: Suggestion: try_realloc


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.


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