You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kvrocks.apache.org by GitBox <gi...@apache.org> on 2022/05/27 12:43:09 UTC

[GitHub] [incubator-kvrocks] PragmaTwice commented on issue #609: Memory leaks in Lua::redisGenericCommand

PragmaTwice commented on issue #609:
URL: https://github.com/apache/incubator-kvrocks/issues/609#issuecomment-1139583617

   > @PragmaTwice Really good catch, I wasn't aware the destructor would be ignored by longjump. Lua supported using `try..catch` to workaround the C++ condition: https://github.com/KvrocksLabs/lua/blob/3e2d94b3b98d774dcd4fb448b1cb64615ae0590d/src/luaconf.h#L606
   
   Yeah, I found two method to solve this problem:
   1. build lua with a C++ compiler like `CC=g++`, then lua will use these `try..catch` stuff to implement `lua_error` or other functions, refer to "4.6 – Error Handling in C" in https://www.lua.org/manual/5.3/manual.html.
   2. raise C++ exception manually, like in http://lua-users.org/wiki/ErrorHandlingBetweenLuaAndCplusplus or https://stackoverflow.com/questions/4615890/how-to-handle-c-exceptions-when-calling-functions-from-lua.
   
   Which solution do you prefer? @git-hulk 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org