Memory Performance in Games.

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
avansc
Respected Programmer
Respected Programmer
Posts: 1708
Joined: Sun Nov 02, 2008 6:29 pm

Memory Performance in Games.

Post 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!.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
User avatar
Kleithap
ES Web Developer
ES Web Developer
Posts: 324
Joined: Sat Jan 26, 2008 9:03 am
Location: Amsterdam

Re: Memory Performance in Games.

Post by Kleithap »

Nice and clear example.
Post Reply