[SDL] ot - memory leaks
James Barrett
xucaen at gmail.com
Sun Aug 5 13:05:30 PDT 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
neil at cloudsprinter.com wrote:
> Quoting "Ryan C. Gordon" <icculus at icculus.org>:
>
>>> right now i'm just gonna concentrate on getting the game to how i
>>> want and go
>>> about memory leaks when i'm finished.
>> No, no, no.
>>
>
> just for the record ( or the ongoing saga it may seem ) i just went
into linux
> got my program compiled by GCC and at a certain point it crashes,
presumbably
> due to dodgy use of memory... valgrind spits me 9 printout pages worth of
> output for me to stare at blankly.
>
> sometimes gcc lets me get away with certain things, and other times
mingw will
> not other things, and other times my RISC OS gcc will allow things other
> compilers blah blah
>
> basically my code is for want of a more offencive word, borked.
>
> sorry for the spam, but the gf, the four year old and the six year old
> just dont
> understand my dilemas ;)
I am wondering if it would really be so bad to use some c++. For
example, if you have a struct Foo, use the c++ "new" to create it.
typedef struct testFoo
{
int x;
}testFoo;
int main(int argc, char *argv[])
{
testFoo* myFoo = 0;
//... do some work..
//create an instance of Foo;
if(myFoo)
{
//if myFoo is not null, then delete it.
delete myFoo;
}
myFoo = new testFoo();
//..., do some more work
//always delete Foo before exiting
delete myFoo;
return EXIT_SUCCESS;
}
jim
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFGti2JQuDJiZ/QrH0RAm0kAJ9vfdAD0cBm9ugKeLa6DTiZShRwYQCbB2OB
vVKfp7UMxwq7kTg52WycxQM=
=UEJ3
-----END PGP SIGNATURE-----
More information about the SDL
mailing list