cpio: reduce memory pressure
The current implementation was copying the whole file contents into an
array and then into stringstream which under the hood copied it again
into even bigger array. These allocations were causing memory
fragmentation which some times led to malloc failure.
The new approach is using fixed amount of memory. For each file it
wraps the cpio input stream in a restricted stream which limits the
amount of data that can be read from it so that it represents a view
for only that file's data. After the consumer has read it we simply
ignore the remaining padding from the cpio stream.
This fixes issue #66
Signed-off-by:
Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Loading
Please register or sign in to comment