You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[GCOptimize]
public struct Bar
{
public IntPtr Daz;
}
public static class LuaApiTests
{
// 当从 Lua 调用时,这个函数工作时不会有任何内存分配
public static IntPtr Foo()
{
return (IntPtr)123;
}
// 当从 Lua 调用时,这个函数会导致内存垃圾分配
public static Bar Bar()
{
return new Bar()
{
Daz = (IntPtr)123,
};
}
}
The text was updated successfully, but these errors were encountered:
我正在使用 GCOptimize 特性在 C# 和 Lua 之间传递结构体,以避免内存分配。但是在我的一些数据中,我存储了一个 IntPtr 值。这似乎导致周围的结构体被装箱为用户数据,而不是按值传递。例如:
The text was updated successfully, but these errors were encountered: