The displayed FILE SIZE in the right column is the size in the binary file
(exe or WASM). The size in memory would be on the left (where all those
NANs are, I guess that's a bug in that specific tool).
For instance, if you have a 32 MB *non-initialized* global array (which
would be zero-initialized at start), it would show up as just a few bytes
on the right.
I guess that NAN bug is WASM specific. If you can compile the same code to
the native architecture, at least bloaty should show the expected
memory-size in the left column.
On Thursday, 4 July 2019 06:35:43 UTC+2, caiiiycuk wrote:
>
> > 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] <javascript:>>:
> >
> > On Tue, Jul 2, 2019 at 8:02 PM Александр Гурьянов <[email protected]
> <javascript:>> 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] <javascript:>.
>
> > > 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] <javascript:>.
>
> > 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/5bf7e241-b500-4fc8-91da-bd0b2b8217b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.