summaryrefslogtreecommitdiff
path: root/src/luma/emulator/drop.rs
blob: 6f87867694fd57351f80ad79b8dd29deb2cf2c25 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
// Copyright 2021-2023 Gabriel Jensen.

use crate::luma::MEMORY_SIZE;
use crate::luma::emulator::Emulator;

use std::alloc::{dealloc, Layout};
use std::mem::size_of;

impl Drop for Emulator {
	fn drop(&mut self) {
		unsafe { dealloc(self.memory, Layout::new::<[u32; MEMORY_SIZE / size_of::<u32>()]>()) };
	}
}