Skip to content
Snippets Groups Projects
Commit 9ee4a63e authored by Tomasz Grabiec's avatar Tomasz Grabiec
Browse files

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: default avatarTomasz Grabiec <tgrabiec@cloudius-systems.com>
parent 57131a6f
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment