summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Orlenko <zxteam@protonmail.com>2022-10-09 13:56:06 +0100
committerAlex Orlenko <zxteam@protonmail.com>2022-10-09 13:56:06 +0100
commitcfa959e599597415d6b2afaa31998f0a7bd22851 (patch)
tree872dc1bd70de564c76f7d2870087c8422e770d8a
parente523fb2c8651a0aecda4353f4d72700083e0027a (diff)
downloadmlua-cfa959e599597415d6b2afaa31998f0a7bd22851.zip
Don't allocate extra byte for userdata (luau)
-rw-r--r--src/util.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/util.rs b/src/util.rs
index 3bfdac9..c5bbe08 100644
--- a/src/util.rs
+++ b/src/util.rs
@@ -313,7 +313,7 @@ pub unsafe fn push_userdata<T>(state: *mut ffi::lua_State, t: T, protect: bool)
ptr::drop_in_place(ud as *mut T);
}
- let size = mem::size_of::<T>() + 1;
+ let size = mem::size_of::<T>();
let ud = if protect {
protect_lua!(state, 0, 1, |state| {
ffi::lua_newuserdatadtor(state, size, destructor::<T>) as *mut T