how to create an array of scoped objects ?
Flaze07
christianseiji.cs at gmail.com
Tue Jul 3 10:56:26 UTC 2018
On Tuesday, 3 July 2018 at 10:00:00 UTC, Mike Parker wrote:
>
> The only way you're going to be leaking resources is if the app
> is long running and the resource objects are never collected.
> I'd be more concerned about the nondeterministic nature of the
> destructor calls, particularly what happens at app shut down if
> the render window destructor is called before any thing that
> depends on the graphics context. If the library doesn't account
> for that, you'll get random crashes when the app exits.
>
> If you need to release resources while the app is running, just
> use resource.destroy(). This will make sure the destructor is
> called and the object is reset to its init state, and you can
> maintain determinism.
hmm, I assume you know about DSFML, so... i.e
void main( string args[] ) {
auto win = new RenderWindow( VideoMode( 400, 400 ), "resource
leak ?" );
win.close();
}
//in this context, is there any memory leak ? because I saw from
the source that the render window is freed during the destructor
calls
More information about the Digitalmars-d-learn
mailing list