Giter Club home page Giter Club logo

Comments (3)

pangweiwei avatar pangweiwei commented on August 18, 2024

Not close lua vm used for user use Lua api again on lua been close, if so caused crash , there is nothing other bug. If you make sure don't use lua on closed , you can close it.

发自我的 iPhone

在 2015年10月12日,上午10:53,jshmrsn [email protected] 写道:

I've been intentionally closing my LuaState objects for awhile, believing that was closing the LuaVMs. I was very confused by why my Unity editor sometimes would fail to allocate new pointers in my native extensions. I eventually discovered the comments in LuaState:

            // be careful, if you close lua vm, make sure you don't use lua state again,
            // comment this line as default for avoid unexpected crash.
            // LuaDLL.lua_close(L);
            // L = IntPtr.Zero;

This was very surprising to me. While it's nice that the comments are there describing why you commented those lines out, there's nothing leading users of Slua to those comments. Either way, not closing the lua VM because of an "unexpected crash" is simply hiding other issue with the user's code if those crashes occur. Indeed, once I added the lua_close back, I did not start to experience other issues, but those issues were real and needed to be fixed.

In fact, one of the issues I discovered by re-adding lua_close was a rare (but very annoying) bug with Slua. In ObjectCache.del, the lua state is correctly removed from the multiState map, BUT oldl and oldoc are not cleared out (set to IntPtr.Zero / null). I believe this leads to a rare condition, where if a lua state is destroyed, and then another is created, the second lua state may have the exact same pointer address as the previous. Because it has the same address as before, the cache incorrectly pulls up the dead cache from oldoc.

Similarly, when a LuaState is closed, it should be removed from LuaState.statemap, and LuaState.oldptr and LuaState.oldstate should be cleared out. This doesn't appear to be happening on master, either.


Reply to this email directly or view it on GitHub.

from slua.

pangweiwei avatar pangweiwei commented on August 18, 2024

Yes, some static variants are not cleared, let me think.

from slua.

pangweiwei avatar pangweiwei commented on August 18, 2024

I had fix.

from slua.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.