Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible to synchronize vm -> host -> vm? #4

Open
emilmuller opened this issue Oct 11, 2021 · 2 comments
Open

Possible to synchronize vm -> host -> vm? #4

emilmuller opened this issue Oct 11, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@emilmuller
Copy link

emilmuller commented Oct 11, 2021

Hi

I'm trying to compare objects which crosses from VM -> host -> VM. This seems to fail. See the example below. Is it possible to add support for this? :)

Kind regards, Emil

(async () => {
    const vm = (await getQuickJS()).createVm();
    const arena = new Arena(vm, { isMarshalable: true });

    function test(obj) {
        return obj;
    }

    arena.expose({ test });
    console.log(arena.evalCode(`let foo = {}; foo === test(foo)`)); // I want this to log 'true', but it logs 'false'

    arena.dispose();
    vm.dispose();
})();

Also, thanks for this great library! :)

@emilmuller emilmuller changed the title Possible to synchronize vm -> host? Possible to synchronize vm -> host -> vm? Oct 11, 2021
@emilmuller
Copy link
Author

emilmuller commented Oct 11, 2021

Interestingly, a slight modification of the above code produces an error:

(async () => {
    const vm = (await getQuickJS()).createVm();
    const arena = new Arena(vm, { isMarshalable: true });

    function test(obj) {
        return obj;
    }

    arena.expose({ test });
    console.log(arena.evalCode(`let foo = test({}); foo === test(foo)`)); // Modified let foo = test({});

    arena.dispose();
    vm.dispose();
})();

image

Occurs at vm.dispose()

Some handle not disposed? Memory leak?

@rot1024 rot1024 added the bug Something isn't working label Oct 26, 2021
@rot1024
Copy link
Member

rot1024 commented Oct 26, 2021

Thank you for reporting. It seems a bug and should be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants