No it's not. It's never freed before leaving the js_std_init_handlers()
function. Here's an output from Valgrind to support my claim:
==12430== 88 bytes in 1 blocks are definitely lost in loss record 1 of 1
==12430== at 0x4C29F73: malloc (vg_replace_malloc.c:309)
==12430== by 0x486391: js_std_init_handlers (quickjs-libc.c:3771)
==12430== by 0x403189: main (in /home/edwin/mytest)
Thanks,
-Edwin.
On Fri, Apr 16, 2021 at 1:17 AM 罗勇刚(Yonggang Luo) <luoyonggang@xxxxxxxxx>
wrote:
That's not true, it's freed at
void js_std_free_handlers(JSRuntime *rt)
On Fri, Apr 16, 2021 at 5:13 AM Edwin Coronado <hi@xxxxxxxxxxxxxxxx>
wrote:
After doing some profiling using Valgrind on an executable I compiled
using qjsc I discovered a possible memory leak in the js_std_init_handlers
function in quickjs-libc.c in the 2021-03-27 quickjs version.
Take a look at:
https://github.com/bellard/quickjs/blob/master/quickjs-libc.c#L3769
It seems that the "JSThreadState *ts;" is never freed in the function. I
have attached a patch file for this.
Thanks,
-Edwin
--
此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo