> Do you want to find our what constructs in your source are generating
> 30099056 bytes of static data?
Yes basically it's my question.
I dig more, and now it seems even more strange for me. Compiler ask me
to set TOTAL_MEMORY min to ~30Mb. I used bloaty/twiggy(thanks, great
tool!) to show data secion of generated wasm:
bloaty:
VM SIZE FILE SIZE
-------------- --------------
NAN% 0 Code 1.76Mi 86.7%
NAN% 0 Data 266Ki 12.8%
NAN% 0 Element 4.84Ki 0.2%
NAN% 0 Function 3.63Ki 0.2%
NAN% 0 Import 1.08Ki 0.1%
NAN% 0 Type 446 0.0%
NAN% 0 Export 172 0.0%
NAN% 0 Global 21 0.0%
NAN% 0 [WASM Header] 8 0.0%
100.0% 0 TOTAL 2.03Mi 100.0%
So data is ~266Kb
Next I switched to emmaloc, to find firstRegion location(firstRegion
is begining of heap in emmalloc). It's possible to find it with
this hack: printf("firstRegion: %d\n", (size_t) sbrk(0) - mallinfo().arena);
firstRegion: 36476272
So heap started at ~34Mb, how I can understand which data is placed in
0..34Mb section?
> You can also inspect you object files with wasm-objdump or try
passing `-Wl,--verbose` at link time and the linker reports some data
layout information.
-Wl,--verbose on link step ended with warning that --verbose is unknown flag.
ср, 3 июл. 2019 г. в 23:56, 'Sam Clegg' via emscripten-discuss
<[email protected]>:
>
> On Tue, Jul 2, 2019 at 8:02 PM Александр Гурьянов <[email protected]> wrote:
> >
> > Hi. I am trying to set TOTAL_MEMORY to 32mb, but compiler told me:
> >
> > shared:ERROR: Memory is not large enough for static data (30099056)
> > plus the stack (5242880), please increase TOTAL_MEMORY (33554432) to
> > at least 35342960
> >
> > Is there any way to find what and where this data located?
>
> What exactly are you asking for? Do you want to find our what
> constructs in your source are generating 30099056 bytes of static
> data? There is a tool called twiggy that might help:
> https://github.com/rustwasm/twiggy. It mostly focuses on code size
> and I'm not sure data symbols are accessible, but it might be of some
> help. You can also inspect you object files with wasm-objdump or try
> passing `-Wl,--verbose` at link time and the linker reports some data
> layout information.
>
> If you want to reduce your overall memory you could reduce your stack
> size by setting, e.g `-s TOTAL_STACK=1M`. Most programs don't need
> 5Mb of stack.
>
> >
> > 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 [email protected].
> > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/emscripten-discuss/CAKOm%3DVHzwER66gCjAVPpccE%2Bu%3DaFMk6J65zGa46_cdpvqpLfSQ%40mail.gmail.com.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/emscripten-discuss/CAL_va2_Tp9wVL0%3D8ei6Ena9byg7%3Dpi_%3DVMsPkF_kTm6oiChkSA%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/emscripten-discuss/CAKOm%3DVHjUvZqQkoiezn3AdTvttk%2BEgMk7Xp%3DTCfGCdfPooyhjw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.