]> git.proxmox.com Git - libgit2.git/commit
zstream: grow based on used memory rather than allocated
authorCarlos Martín Nieto <cmn@dwim.me>
Sat, 26 Apr 2014 16:04:43 +0000 (18:04 +0200)
committerCarlos Martín Nieto <cmn@dwim.me>
Sat, 26 Apr 2014 16:04:43 +0000 (18:04 +0200)
commitc7f86efb13815554d5b5e7c58bf19769e99c1357
tree9e39d6083a013a675aa4434c31012d04286e3baf
parent4f9d54146d569fffb679386fd3057e571afacd1f
zstream: grow based on used memory rather than allocated

When deflating data, we might need to grow the buffer. Currently we
add a guess on top of the currently-allocated buffer size.

When we re-use the buffer, it already has some memory allocated; adding
to that means that we always grow the buffer regardless of how much we
need to use.

Instead, increase on top of the currently-used size. This still leaves
us with the allocated size of the largest object we compress, but it's a
minor pain compared to unbounded growth.

This fixes #2285.
src/zstream.c