SFML community forums
Help => Graphics => Topic started by: Reborn on April 05, 2014, 06:55:15 pm
-
Hello,
i just load 1 Pic with 7,87 kb into the RAM by using the Function m_textureField.loadFromFile(filePath); and my main memory goes up from 2,5 to 20 Mb, is this normaly possible? When i load 200 pics more with the same size the main memory goes up to 50 MB.
-
Exactely how do you measure this memory consumption?
Be aware that many image formats are compressed, so size on disk will be smaller than when loaded (and decompressed) in memory.
Also, loading the image could trigger loading of library code.
-
GetProcessMemoryInfo().
When i call window.update() in a loop, the ram increase until it reach 10Mb more.
-
Why do people always try to monitor memory usage if they've no idea, neither abstract nor practical, how memory gets managed? ;)
If something makes one memory allocation chances are probably around 90+% that it will do another allocation at one point and thus if you tell the OS to allocate some memory, it will provide you with more memory than actually needed, while still being able to take it away again, if memory is running out.
GetProcessMemoryInfo() probably provides about the same information as the task manager and thus is not a good way to track memory usage.
Also as Jesper mentioned, image files on the harddisk are usually smaller, since you use a compression algorithm, but when loaded in memory every single pixel is accounted for.