Memory leak in QuickJs backend
Archie3d opened this issue · 2 comments
Archie3d commented
Hi,
When compiled with QuickJs backend I experience memory leaks reported by MSVC compiler.
I use std::shared_ptr<script::ScriptEngine>
with provided script::ScriptEngine::Deleter()
.
One problem is inside QjsEngine::destroy()
which is missing the delete this;
statement.
And another one is in MessageQueue.cc
because of the global static runningQueue_
.
Could be a false-positive, but it can be fixed by moving the runningQueue_
inside the getRunningQueue()
function:
using RunnineQueueMap = std::unordered_map<MessageQueue*, int>;
static inline RunnineQueueMap& getRunningQueue() {
SCRIPTX_THREAD_LOCAL(RunnineQueueMap, runningQueue_);
return internal::getThreadLocal(runningQueue_);
}
Thanks!
Great project!
LanderlYoung commented
Thanks for reporting, will check this out.
LanderlYoung commented
Fixed.
The false position will not be considered serious enough to be fixed for now.
However, ASAN checks will be enabled on Linux by GitHub workflow soon.