5 ms·
How does it occupy 30MB ram but 5MB disk space does it grow
by BigParm 2y ago
How does it occupy 30MB ram but 5MB disk space does it grow
- a-french-anon 2y agovoid *p = malloc(30 * 1024 * 1024);
- BigParm 2y agoMakes sense. It's intuitive when you specify a number of bytes. I have myself been allocating memory using "new" so idk how my broken brain asked such a dumbass question.
- genezeta 2y agoIn case your question is sincere, this is normal. Generally, a program on disk contains code. Part of that is the description of certain structures. Say you have an editor which can load a file, you have to have structures to hold that file, to keep track of the undo history, to represent the file with colours (syntax highlighting) and whatever. Your editor may have a Lua VM inside running plugins that you load. That VM will reserve additional memory to run those plugins. And so on. All that only exists while the program is running, but not on disk.