Reduce memory used by libtar when extracting files.
commit20f460bd4ddf5ee74c4e2367650c692a6808c707
authorPer Lidén <per@fukt.bth.se>
Mon, 13 Jun 2011 21:51:37 +0000 (13 17:51 -0400)
committerChris Frey <cdfrey@foursquare.net>
Mon, 13 Jun 2011 21:57:16 +0000 (13 17:57 -0400)
tree385c582f6d2147cbaf20b50019ddbed2a00c8f1f
parentfcb6cd7be4481c99238cda177c2b8fc4c35a43b6
Reduce memory used by libtar when extracting files.

The patch below drastically reduces the amount of memory used by libtar
when extracting files. For each extracted file a 8K struct (MAXPATHLEN is
4096 in Linux) is allocated and inserted in the hashtable for hardlink
mapping. However, in the normal case only a tiny part of those 8K is used.
The patch below calculates the size and allocates no more memory than
needed.

When I unpacked a tar with ~550 files, the memory consumption for the
hashtable went from about 4Mb down to about 200Kb.

/Per

https://lists.feep.net:8080/pipermail/libtar/2003-October/000162.html
lib/extract.c