Page 1 of 1

Memory Performance in Games.

Posted: Mon Nov 10, 2008 4:41 pm
by avansc
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:
Image

Image

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:
Image

Image


if your code is slow and memory intensive. allways remember that evil hids in loops!.

Re: Memory Performance in Games.

Posted: Wed Nov 12, 2008 2:09 pm
by Kleithap
Nice and clear example.