Memory Performance in Games.
Posted: Mon Nov 10, 2008 4:41 pm
okay, people always say things like yeah, you can be much more efficient in C/C++ than on other languages.
that statement is VERY TRUE, but even more deceptive, because if you dont know how to properly mannage
you memory you will be fucked.
the first is an example of good memory management.
notice the free(a) inside the loop.
exhibit A:
this is an example of poor management, the free is non exsistant. this causes you to assign new memory everytime, and the old memory stays locked and unusable. the code also too 87.4 times as long to complete.
exhibit B:
if your code is slow and memory intensive. allways remember that evil hids in loops!.
that statement is VERY TRUE, but even more deceptive, because if you dont know how to properly mannage
you memory you will be fucked.
the first is an example of good memory management.
notice the free(a) inside the loop.
exhibit A:
this is an example of poor management, the free is non exsistant. this causes you to assign new memory everytime, and the old memory stays locked and unusable. the code also too 87.4 times as long to complete.
exhibit B:
if your code is slow and memory intensive. allways remember that evil hids in loops!.