SFML community forums
Bindings - other languages => DotNet => Topic started by: huma35 on January 17, 2015, 07:49:00 pm
-
Hi! I'm using SFML.NET for my project. My question is: What will happen if I don't use Dispose() function? Does GC ignore disposable objects even though they are out of scope and collectable? Thanks.
-
This question is not SFML-specific, so it's probably better asked elsewhere.
For example, this SO Q&A appears to answer your question: https://stackoverflow.com/questions/4267729/what-happens-if-i-dont-call-dispose-on-the-pen-object
-
This question is not SFML-specific, so it's probably better asked elsewhere.
For example, this SO Q&A appears to answer your question: https://stackoverflow.com/questions/4267729/what-happens-if-i-dont-call-dispose-on-the-pen-object
So I think I should call Dispose() for all objects from SFML library since they are unmanaged.
-
You should read carefully all the answers and comments in this SO thread.
Calling Dispose() is only useful if you need deterministic resource destruction. But if you don't care, the GC will correctly collect the instances, and since SFML classes correctly implement the IDisposable interface, unmanaged resources will be correctly destroyed as well.
When something's not clear, you can have a look at how the examples of the SFML.Net SDK are written, and use them as a good reference.