Dear forum users! In compliance with the new European GDPR regulations, we'd just like to inform you that if you have an account, your email address is stored in our database. We do not share your information with third parties, and your email address and password are encrypted for security reasons.
New to the forum? Say hello in this topic! Also make sure to read the rules.
New to the forum? Say hello in this topic! Also make sure to read the rules.
Call Dispose() after object removal?
Forum rules
By using the forum you agree to the following rules.
By using the forum you agree to the following rules.
- JakSparro98
- Superfighter
- Posts: 530
- Joined: Fri Jul 15, 2016 7:56 pm
- Started SFD: PreAlpha 1.0.5
- Location: Rome, Italy
- Gender:
- Age: 25
Call Dispose() after object removal?
I was wondering if there is some impact on performance when I force a Dispose() call on objects implemented with IDispose or is it provided in the destructor itself?
0 x
-
- Superfighter
- Posts: 66
- Joined: Wed Dec 21, 2016 4:22 am
- SFD Account: Huevon NEO
- SFD Alias: Huevon SFD
- Started SFD: PreAlpha 1.8.8
- Location: Honduras
- Gender:
- Age: 21
Exactly Jack what is the IDispose() call ?
0 x
HINT: You will not surprise me if you are good with snipers and magnums and katanas; but I will give my respect for someone who is a weapon-master. So don't wait any cheer marksmen...
- JakSparro98
- Superfighter
- Posts: 530
- Joined: Fri Jul 15, 2016 7:56 pm
- Started SFD: PreAlpha 1.0.5
- Location: Rome, Italy
- Gender:
- Age: 25
sorry I've misspelled, the Dispose() method is in the IDisposable class and is called to free the resources of the objects that are implementing this class.Dumby Eggy wrote:Exactly Jack what is the IDispose() call ?
But I'm wondering if it is automatically called after object destruction or I have to call it manually after I call Destroy() or Remove().
I make this question because I can't manage to solve the memory leak in my AI project.
0 x
- Gurt
- Lead Programmer
- Posts: 1884
- Joined: Sun Feb 28, 2016 3:22 pm
- Title: Lead programmer
- Started SFD: Made it!
- Location: Sweden
- Gender:
- Age: 34
Dispose() is called internally as soon as an object is removed or destroyed. You don't have to think about it. I recommend that you don't call Dispose() at all unless you have implemented your own objects that needs to be disposed.
Sometimes .NET doesn't release memory until the next Garbage Collection is run. This won't happen until memory needs to be freed or until the next match restart. So depending on what you do you might see the memory raise up to 1 GB or more for SFD. Don't worry about it (unless you actually get out-of-memory crashes).
Sometimes .NET doesn't release memory until the next Garbage Collection is run. This won't happen until memory needs to be freed or until the next match restart. So depending on what you do you might see the memory raise up to 1 GB or more for SFD. Don't worry about it (unless you actually get out-of-memory crashes).
0 x
Gurt
- JakSparro98
- Superfighter
- Posts: 530
- Joined: Fri Jul 15, 2016 7:56 pm
- Started SFD: PreAlpha 1.0.5
- Location: Rome, Italy
- Gender:
- Age: 25
Well, how can I say? It's happened, my bad scripting skills managed to reach the goal.Gurt wrote:Don't worry about it (unless you actually get out-of-memory crashes).
Anyway, I'm going to release the current state of the code in a dedicated thread, also for promoting the posibility to change / improve it by the community but mainly to recieve any tip for the memory problem.
0 x
-
- Superfighter
- Posts: 66
- Joined: Wed Dec 21, 2016 4:22 am
- SFD Account: Huevon NEO
- SFD Alias: Huevon SFD
- Started SFD: PreAlpha 1.8.8
- Location: Honduras
- Gender:
- Age: 21
Ehehehe, could you show me an example of using Dispose() ? I have no idea of how to adapt this.
0 x
HINT: You will not surprise me if you are good with snipers and magnums and katanas; but I will give my respect for someone who is a weapon-master. So don't wait any cheer marksmen...
- JakSparro98
- Superfighter
- Posts: 530
- Joined: Fri Jul 15, 2016 7:56 pm
- Started SFD: PreAlpha 1.0.5
- Location: Rome, Italy
- Gender:
- Age: 25
No problem, let me only to tidy up a bit the code and fill it with the right comment rate.Gurt wrote:Care to share the script so I can investigate? Maybe it's a problem in the SFD core code.
In plain language it's a method to call when you are about not to use object instances anymore but as Gurt Said you aren't to care about it unless you have particular objects from a class that implements it, in the other cases it is automatically called.Dumby Eggy wrote:Ehehehe, could you show me an example of using Dispose() ? I have no idea of how to adapt this.
1 x
-
- Superfighter
- Posts: 66
- Joined: Wed Dec 21, 2016 4:22 am
- SFD Account: Huevon NEO
- SFD Alias: Huevon SFD
- Started SFD: PreAlpha 1.8.8
- Location: Honduras
- Gender:
- Age: 21
Jejeje yeah but I wanted a script example dude. anyway, thanks for explain it again
0 x
HINT: You will not surprise me if you are good with snipers and magnums and katanas; but I will give my respect for someone who is a weapon-master. So don't wait any cheer marksmen...
- JakSparro98
- Superfighter
- Posts: 530
- Joined: Fri Jul 15, 2016 7:56 pm
- Started SFD: PreAlpha 1.0.5
- Location: Rome, Italy
- Gender:
- Age: 25
here an example:Dumby Eggy wrote:Jejeje yeah but I wanted a script example dude. anyway, thanks for explain it again
Download
0 x