well actually you are wrong.

lets say, you create a game with many enemies, when an enemy dies, you delete the object, and when one spawns you create an object, reusing could be done, but if you use a record it would be quicker to delete and create a new (and it also depends on the sitation), with an object you will use twice as much time creating that object, then if you created just in a block of memory, ie a simple struct/record.

anyone that has 'real' experience writing large simulations or games will tell you the same. classes do make things more readable, but they do have larger overheads, and when it comes to creating and destroying, a class is much slower, because they are managing things that most of the time do not need to be managed, they should be dealt with by the programmer.

also when writing a game, why would you want to clear memory? infact writing any program, 9 times out of 10, you do not need to clear memory unless writing a specificed size of data to a file. a string you will end with a nullchar, sizes should be params to external procs so they can copy the correct amount of data.

lets just say

[pascal]
v := GetTickCount;
for i := 1 to 1000000 do begin
sc := TSomeClass.Create;
sc.Free;
end;
WriteLn(GetTickCount - v);

v := GetTickCount;
for i := 1 to 1000000 do begin
GetMem(ss, SizeOf(TSomeStruct));
FillChar(ss^, SizeOf(TSomeStruct), 0);
FreeMem(ss, SizeOf(TSomeStruct));
end;
WriteLn(GetTickCount - v);
[/pascal]

now you will find

objects = 203ms
records = 110ms


anyways i think this thread needs to get back on topic.

;MM;