Renegade C++ Cleanup [message #437105] |
Mon, 27 September 2010 16:31 |
|
halo2pac
Messages: 659 Registered: December 2006 Location: Near Cleveland, Ohio
Karma: 0
|
Colonel |
|
|
Hey guys.
I'm working on a lot of C++ that has to do with renegade in general (servers, scripts, ect).
When you write code in let say a script what do you have to delete to make sure you don't have any memory leaks?
So far I know of when you create a string like:
const char *Nick
you have to delete it.
what other things are there to delete, and how do I delete them?
*off the top of my head Vector3 is one of the ones where I am wondering if I have to delete it after creating one.
Thanks!
Rene-Buddy | Renegade X
Join the fight against Obsessive-Compulsive Posting Disorder. Cancel is ur friend.
*Renegade X Dev Team Member*
|
|
|
Re: Renegade C++ Cleanup [message #437109 is a reply to message #437105] |
Mon, 27 September 2010 19:19 |
|
Basically anywhere you see something like new char[100], thats allocating memory that you need to clean up.
If you do something like Vector3 v;
v.X = 1;
v.Y = 1;
v.Z = 1;
then, no, you dont have to clean up that Vector3.
Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
|
|
|
|
|
Re: Renegade C++ Cleanup [message #437155 is a reply to message #437105] |
Tue, 28 September 2010 09:19 |
|
If you have something like this
char test[100];
then you dont need to do anything to delete it, it gets deleted automatically.
Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
|
|
|
|
|
Re: Renegade C++ Cleanup [message #437160 is a reply to message #437159] |
Tue, 28 September 2010 10:59 |
|
saberhawk
Messages: 1068 Registered: January 2006 Location: ::1
Karma: 0
|
General (1 Star) |
|
|
cAmpa wrote on Tue, 28 September 2010 13:49 | I think i don't know all your fixes, could you show me all?
|
Gladly; I just need you to show me all the fixes I've made. I don't actually remember all the changes I've made, searching for posts made by me is going to give you better results. One thing I'm pretty sure of is that newer posts I've made including code still contain the fixes of earlier posts.
|
|
|