Hey guys,
i am wondering, if you load a file in basically any language, how much memory does the file occupy. Like there's the case that usually more memory is used rather than the actual size of the file because the data of the file is mapped to data types for example if a file has 3 numbers that are 1,2 and 3, it will end up being 4 bytes file but if you load them in a program, they will be stored as ints resulting in each being 4 bytes(32 bits), correct?

But um ... what if you load a file say 100 MB size, and you read the content as a string. Is the memory occupied 100 MB as well because maybe everything is represented in the form of chars 1 byte each?

Edited by Slavi

2 Years
Discussion Span
Last Post by vegaseat

It depends on the computer language you are using. You can specify the size of an integer (16, 32, 64 bits). Also your characters nowadays are unicode and take up more than 1 byte.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.