Closed try-agaaain closed 1 year ago
I found that this problem is caused by hello.cc
not being able to find hello.wasm
, after changing the hello.wasm
path in hello.cc
to the correct one:
std::ifstream file("hello.wasm");
However, there is another problem, when executing make run-hello-c
, the following error will occur:
$make run-hello-c
Initializing...
Loading binary...
Validating module...
Compiling module...
Creating callback...
Instantiating module...
Extracting export...
Calling export...
Calling back...
> Hello World!
Shutting down...
Done.
Leaked 1 instances of wasm::Engine, made 1, freed 0!
Leaked 1 instances of wasm::Store, made 1, freed 0!
Leaked 1 instances of wasm::FuncType, made 10, freed 9!
Leaked 1 instances of wasm::Module, made 3, freed 2!
Leaked 1 instances of wasm::Instance, made 1, freed 0!
Leaked 1 instances of wasm::Func, made 2, freed 1!
...
#21 0x558dcbabceac in wasm_module_new /home/todo/internship/wasm-c-api/src/wasm-c.cc:740:25
#22 0x558dcba90334 in main /home/todo/internship/wasm-c-api/example/hello.c:53:31
#23 0x7f797475dd8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
Indirect leak of 40 byte(s) in 1 object(s) allocated from:
#0 0x558dcba8db4d in operator new(unsigned long) (/home/todo/internship/wasm-c-api/out/example/hello-c+0x17cb4d) (BuildId: 21d447bafe28612d21dcccbf8ef47369b70ae682)
#1 0x558dcbc2e0f3 in v8::internal::CodeObjectRegistry::RegisterNewlyAllocatedCodeObject(unsigned long) (/home/todo/internship/wasm-c-api/out/example/hello-c+0x31d0f3) (BuildId: 21d447bafe28612d21dcccbf8ef47369b70ae682)
#2 0x558dcc1bf6cd in v8::internal::DeserializerAllocator::AllocateRaw(v8::internal::AllocationSpace, int) (/home/todo/internship/wasm-c-api/out/example/hello-c+0x8ae6cd) (BuildId: 21d447bafe28612d21dcccbf8ef47369b70ae682)
#3 0x558dcc1c3042 in v8::internal::Deserializer::ReadObject(int) (/home/todo/internship/wasm-c-api/out/example/hello-c+0x8b2042) (BuildId: 21d447bafe28612d21dcccbf8ef47369b70ae682)
#4 0x558dcc1c03ce in bool v8::internal::Deserializer::ReadData<v8::internal::FullMaybeObjectSlot>(v8::internal::FullMaybeObjectSlot, v8::internal::FullMaybeObjectSlot, int, unsigned long) (/home/todo/internship/wasm-c-api/out/example/hello-c+0x8af3ce) (BuildId: 21d447bafe28612d21dcccbf8ef47369b70ae682)
#5 0x558dcbbbb4c7 in v8::internal::Heap::IterateStrongRoots(v8::internal::RootVisitor*, v8::internal::VisitMode) (/home/todo/internship/wasm-c-api/out/example/hello-c+0x2aa4c7) (BuildId: 21d447bafe28612d21dcccbf8ef47369b70ae682)
#6 0x558dcbe32c8c in v8::internal::StartupDeserializer::DeserializeInto(v8::internal::Isolate*) (/home/todo/internship/wasm-c-api/out/example/hello-c+0x521c8c) (BuildId: 21d447bafe28612d21dcccbf8ef47369b70ae682)
#7 0x558dcbb72f1a in v8::internal::Isolate::Init(v8::internal::ReadOnlyDeserializer*, v8::internal::StartupDeserializer*) (/home/todo/internship/wasm-c-api/out/example/hello-c+0x261f1a) (BuildId: 21d447bafe28612d21dcccbf8ef47369b70ae682)
#8 0x558dcbb731b8 in v8::internal::Isolate::InitWithSnapshot(v8::internal::ReadOnlyDeserializer*, v8::internal::StartupDeserializer*) (/home/todo/internship/wasm-c-api/out/example/hello-c+0x2621b8) (BuildId: 21d447bafe28612d21dcccbf8ef47369b70ae682)
#9 0x558dcbe304f0 in v8::internal::Snapshot::Initialize(v8::internal::Isolate*) (/home/todo/internship/wasm-c-api/out/example/hello-c+0x51f4f0) (BuildId: 21d447bafe28612d21dcccbf8ef47369b70ae682)
#10 0x558dcbafaac8 in v8::Isolate::Initialize(v8::Isolate*, v8::Isolate::CreateParams const&) (/home/todo/internship/wasm-c-api/out/example/hello-c+0x1e9ac8) (BuildId: 21d447bafe28612d21dcccbf8ef47369b70ae682)
#11 0x558dcbafabce in v8::Isolate::New(v8::Isolate::CreateParams const&) (/home/todo/internship/wasm-c-api/out/example/hello-c+0x1e9bce) (BuildId: 21d447bafe28612d21dcccbf8ef47369b70ae682)
#12 0x558dcba9cb44 in wasm::Store::make(wasm::Engine*) /home/todo/internship/wasm-c-api/./src/wasm-v8.cc:431:18
#13 0x558dcbaaf4ec in wasm_store_new /home/todo/internship/wasm-c-api/src/wasm-c.cc:233:24
#14 0x558dcba9023b in main /home/todo/internship/wasm-c-api/example/hello.c:24:25
#15 0x7f797475dd8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
SUMMARY: AddressSanitizer: 107552 byte(s) leaked in 1632 allocation(s).
make: *** [Makefile:120: run-hello-c] Error 1
Hm, that is odd. I cannot reproduce that, so I'm not sure what to advise. All I could do would be running it in a debugger and trying to find out why the deallocations don't do anything.
Thank you for your suggestion, I am unable to resolve the issue at the moment, it might be related to my environment, I plan to temporarily close this issue.
When I execute the
make run-hello-cc
command, everything seems to be fine in the terminal output:However, when I run the executable output from this command, I get an address assignment error:
Here is some information about my machine: