Skip to content

Commit aa7b7dd

Browse files
committed
fix: duplicate free memory issue
1 parent 33db13e commit aa7b7dd

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

app/src/main/java/com/shiqi/testquickjs/MainActivity.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,12 @@ class MainActivity : ComponentActivity() {
3434
) {
3535
Greeting("Android")
3636
Button(onClick = {
37-
quickJSEngine.runJsFileFromAsset("asset:/JsEngineSonicBridge.js")
38-
// quickJSEngine.runJsFileFromAsset("asset:/sonic.kbc1")
37+
// quickJSEngine.runJsFileFromAsset("asset:/JsEngineSonicBridge.js")
3938
quickJSEngine.runJsFileFromAsset("asset:/sonic.js")
40-
val bytes = quickJSEngine.getJsContext().compileJsToBytecode("console.log('Hello, Shiqi!')")
41-
quickJSEngine.getJsContext().evaluateBytecode(bytes)
39+
// val bytes = quickJSEngine.getJsContext().compileJsToBytecode("console.log('Hello, Shiqi!')")
40+
// quickJSEngine.getJsContext().evaluateBytecode(bytes)
4241

43-
Log.i(TAG, "bytes: ${bytes?.size}")
42+
// Log.i(TAG, "bytes: ${bytes?.size}")
4443
}) {
4544
Text("Click Me")
4645
}

quickjs/src/core/runtime.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3163,9 +3163,6 @@ JSValue JS_EvalBytecode(JSContext* ctx, const uint8_t *buf, size_t buf_len) {
31633163
return JS_ThrowTypeError(ctx, "Failed to evaluate bytecode function");
31643164
}
31653165

3166-
// Free the memory allocated for bytecode object
3167-
JS_FreeValue(ctx, obj);
3168-
31693166
return val;
31703167
}
31713168

0 commit comments

Comments
 (0)