Re: realloc but not copy
- From: CBFalconer <cbfalconer@xxxxxxxxx>
- Date: Mon, 23 Oct 2006 18:12:55 -0400
websnarf@xxxxxxxxx wrote:
.... snip ...
I had a similar issue in implementing the Better String Library.
For reasonably large allocations, the performance is usually going
to be limited by the copy. Now, if your data is anything like
Bstrlib's the problem is that the allocated buffer is usually
larger than the amount of valid data that its holding. But
realloc doesn't know this, and so will copy the entire buffer on
realloc if a data move is required.
That is a problem better handled in the realloc function proper.
nmalloc goes to lengths to avoid any copying during realloc. It
can do this because it maintains quickly accessible knowledge of
the size and availability of adjacent memory chunks.
<http://cbfalconer.home.att.net/download/>
--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
.
- Follow-Ups:
- Re: realloc but not copy
- From: James Antill
- Re: realloc but not copy
- References:
- realloc but not copy
- From: ivan . leben
- Re: realloc but not copy
- From: websnarf
- realloc but not copy
- Prev by Date: Re: verify float number
- Next by Date: Re: Evaluation order of assignment statement
- Previous by thread: Re: realloc but not copy
- Next by thread: Re: realloc but not copy
- Index(es):
Relevant Pages
|
|