[File] Piping into file; will it bloat RAM?

Christos Zoulas christos at zoulas.com
Thu Oct 20 13:20:56 UTC 2022


It will generally allocate and read only up to bytes_max which defaults to 7M and can be set by -P bytes=

Best,

christos

> On Oct 20, 2022, at 5:55 AM, Arif Driessen <arifd86 at gmail.com> wrote:
> 
> Hello,
> 
> 
> 
> I am using `file` to get the mime-type of blobs of data streamed to me. I open a process and a pipe, and a pass the bytes as they come to me to `file`. Then I close the pipe and wait for `file` to return me a mime-type.
> 
> 
> 
> This works wonderfully, except, I'm worried, that file may be collecting into RAM the entire contents of the buffer as they are being piped.
> 
> 
> For example, if I am given an 180GiB zip file, and I keep feeding those bytes to the pipe, will it blow up my RAM? Or does `file` employ something cleverl; even if just writing to the file system, or perhaps working on chunks and forgetting the past?
> 
> 
> Thanks for your help!
> 
> 
> Arif Driessen
> 
> 
> --
> File mailing list
> File at astron.com
> https://mailman.astron.com/mailman/listinfo/file
> <sanitizer.log>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.astron.com/pipermail/file/attachments/20221020/b8f808b6/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 235 bytes
Desc: Message signed with OpenPGP
URL: <https://mailman.astron.com/pipermail/file/attachments/20221020/b8f808b6/attachment.asc>


More information about the File mailing list