You can add this:

function getMemory() {
  abort(new Error().stack);
}

and then when it is called it will halt with a stack trace. That can help
figure out what is calling it. (Make sure to build with --profiling so the
stack trace is clear.)


On Mon, Sep 14, 2020 at 7:53 AM 'Sam Clegg' via emscripten-discuss <
emscripten-discuss@googlegroups.com> wrote:

> Can you give steps to reproduce?   Perhaps you can open an issue in the
> bug tracker?
>
> Can you tell which JS function is referencing `getMemory`?    It should
> be removed from the codebase (except if `-s MAIN_MODULE`  is used).
>
> cheers,
> sam
>
>
> On Sun, Sep 13, 2020 at 8:24 PM Александр Гурьянов <caiiiy...@gmail.com>
> wrote:
>
>> Sorry I don't understand what I should do. This error happens on a
>> regular codebase without something special (just libzip and extraction
>> code). I use emsdk, emcmake, cmake and make to compile it. I don't
>> call getMemory or dynamicAlloc from my side, I mean how can I call
>> them before instantiation is finished? There is some pattern in C/C++
>> code that results in this behaviour?
>>
>> P. S. 2.0.2 works fine.
>>
>> пн, 14 сент. 2020 г. в 10:16, 'Sam Clegg' via emscripten-discuss
>> <emscripten-discuss@googlegroups.com>:
>> >
>> > These functions were removed since we managed to remove all our
>> allocations that occurred before startup.
>> >
>> > This is/was an important thing for us to do as it allows wasm-ld (the
>> static linker) to fully determine memory layout and specifically heap
>> location without the need for post-link modifications to the wasm binary.
>> >
>> > You should be able simply call `_malloc` instead, or move your
>> allocation in a C/C++ global?   These are the two approaches that we used
>> to remove all or our internal usage of dynamicAlloc.
>> >
>> > cheers,
>> > sam
>> >
>> > On Sun, Sep 13, 2020 at 8:04 PM Александр Гурьянов <caiiiy...@gmail.com>
>> wrote:
>> >>
>> >> Hi. Just updated emscripten to 2.0.3, everything builds fine but now I
>> >> have error on module instantiation:
>> >>
>> >> ReferenceError: getMemory is not defined
>> >>
>> >> I checked the generated code of Module, and it have:
>> >>
>> >> Module["getMemory"] = getMemory;
>> >>
>> >> but getMemory itself never defined, for example in previous version it
>> was:
>> >>
>> >>             function getMemory(size) {
>> >>                 if (!runtimeInitialized) return dynamicAlloc(size);
>> >>                 return _malloc(size)
>> >>             }
>> >> Also dynamicAlloc is not there.
>> >>
>> >> There are some new compiler flags?
>> >> Thanks
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google
>> Groups "emscripten-discuss" group.
>> >> To unsubscribe from this group and stop receiving emails from it, send
>> an email to emscripten-discuss+unsubscr...@googlegroups.com.
>> >> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/emscripten-discuss/CAKOm%3DVG-dBKPFWGowBuV7Ah%3DA1TLR1koBPBmJhNAY3cd4TcM0Q%40mail.gmail.com
>> .
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups "emscripten-discuss" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> an email to emscripten-discuss+unsubscr...@googlegroups.com.
>> > To view this discussion on the web visit
>> https://groups.google.com/d/msgid/emscripten-discuss/CAL_va2-1kXWHTVq4XCSzpJMvFhjEae45j3sG7JvM%2BBbUCQtUBA%40mail.gmail.com
>> .
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "emscripten-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to emscripten-discuss+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/emscripten-discuss/CAKOm%3DVF5o2iDfMa-qcBp53PA-z_NuMqMnyakuDFGWnUV1DzMiw%40mail.gmail.com
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to emscripten-discuss+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/emscripten-discuss/CAL_va2__y6Bd4M-oR6VpskT%3DGdAqTcp8O1WKnf4hY6itRHz_mQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/emscripten-discuss/CAL_va2__y6Bd4M-oR6VpskT%3DGdAqTcp8O1WKnf4hY6itRHz_mQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to emscripten-discuss+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/CAEX4NpT636rWjiPVqRFEe5punQHS_fieKYZsN_7bGE7yFr7wXQ%40mail.gmail.com.

Reply via email to