memcached bugreport

Paul Lindner lindner at inuus.com
Mon Mar 19 05:40:25 UTC 2007


On Sat, Mar 17, 2007 at 06:10:31PM -0700, Steven Grimm wrote:
> Wasn't this broken by the recent patch that inlined the reallocs? I 
> don't think it's broken in any of the numbered releases. So only people 
> who applied the recent patch would have gotten bitten by it. (I think.)
> 
> Since that patch was also applied to the multithreaded branch, I guess 
> the same problem was probably introduced there too.

mea culpa.

It was my removal of the do_realloc function that caused this problem.

Cut and paste of the args to do_realloc were passed to realloc in
errror.

Is there a way we can test correct behavior for conn_shrink?  I just
checked in changes to t/getset.t that exercise larger buffer sizes,
which should test out some of the realloc code.




/*
 * Reallocates memory and updates a buffer size if successful.
 */
int do_realloc(void **orig, int newsize, int bytes_per_item, int size) {
    void *newbuf = realloc(*orig, newsize * bytes_per_item);
    if (newbuf) {
        *orig = newbuf;
        *size = newsize;
       return 1;
    }
    return 0;
}


-- 
Paul Lindner        ||||| | | | |  |  |  |   |   |
lindner at inuus.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.danga.com/pipermail/memcached/attachments/20070318/aaa44ae4/attachment.pgp


More information about the memcached mailing list