Cause: When detecting file from stdin using "file -", File tried to read whole file from stdin to be able to get additional information about ELF binary even when the file on stdin wasn't ELF binary.
Consequence: File read the whole file from stdin into memory. This wasted memory for bigger files and took lot of time.
Fix: File detects if the file is ELF binary using the ELF magic bytes and reads whole file into memory only when it is sure it is real ELF binary.
Result: Detection of bigger files is faster and does not waste the memory.