[MacOS] Fix memory management (#1342)
* macOS, Reduce memory usage * macOS, Fix memory leak
This commit is contained in:
parent
e4451d6786
commit
fa7a3025ec
2 changed files with 11 additions and 2 deletions
|
|
@ -95,12 +95,13 @@ impl<T> EventLoop<T> {
|
|||
F: FnMut(Event<T>, &RootWindowTarget<T>, &mut ControlFlow),
|
||||
{
|
||||
unsafe {
|
||||
let _pool = NSAutoreleasePool::new(nil);
|
||||
let pool = NSAutoreleasePool::new(nil);
|
||||
let app = NSApp();
|
||||
assert_ne!(app, nil);
|
||||
AppState::set_callback(callback, Rc::clone(&self.window_target));
|
||||
let _: () = msg_send![app, run];
|
||||
AppState::exit();
|
||||
pool.drain();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue