Please omit "Warning: Enlarging memory arrays"

430 views
Skip to first unread message

mertes...@gmail.com

unread,
Jun 30, 2015, 11:29:48 AM6/30/15
to emscripte...@googlegroups.com
Hello,

I use the emcc option -s ALLOW_MEMORY_GROWTH=1 on purpose.
The heap of the programs can get very big and I don't want
to determine a heap size in advance (Please refrain from
telling me that I should not use this option).

When the compiled program runs I get annoying messages:

Warning: Enlarging memory arrays, this is not fast! 16777216,33554432
enlarged memory arrays from 16777216 to 33554432, took 20 ms (has ArrayBuffer.transfer? false)

IMHO it is okay when the compiler warns me about the ALLOW_MEMORY_GROWTH option,
but it is totally unacceptable, when such messages are written at runtime.

I execute the program with node.js and the output of the program is
written to stdout. The program output is interrupted by this stupid messages.

Please change emcc/emscripten to omit this message or at least
provide an option to tell emcc to omit this message.

Many thanks in advance.


Regards,
Thomas Mertes

--
Seed7 Homepage: http://seed7.sourceforge.net
Seed7 - The extensible programming language: User defined statements
and operators, abstract data types, templates without special
syntax, OO with interfaces and multiple dispatch, statically typed,
interpreted or compiled, portable, runs under linux/unix/windows.

Alon Zakai

unread,
Jun 30, 2015, 1:32:11 PM6/30/15
to emscripte...@googlegroups.com
That message should only show up in builds with assertions turned on (-O0, or higher optimization levels with assertions turned on).


--
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-disc...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

mertes...@gmail.com

unread,
Jul 1, 2015, 3:35:43 AM7/1/15
to emscripte...@googlegroups.com
On Tue, Jun 30, 2015 at 19:32:11 UTC+2 Alon Zakai wrote:
> That message should only show up in builds with assertions turned on (-O0, or higher optimization levels with assertions turned on).

Are you referring to the build of emcc/emscripten?
I downloaded the offline installer for emcc/emscripten and installed it. I did not build it.
Where would I get emcc without assertions (at least without this stupid message)?

If 'build' refers to compiling my program with emcc I would like to know how to turn this warning or all assertions off.

BTW.: -O0 normally means no optimization at all. The phrase '-O0 or higher optimization levels' means
for me: always. For me it sounds also strange when e.g. -O2 would turn assertions on, since optimization
for time should make the program faster.

BTW2.: An assertion should recognize when something is totally wrong and terminate the program afterwards.
The warning


Warning: Enlarging memory arrays, this is not fast! 16777216,33554432
enlarged memory arrays from 16777216 to 33554432, took 20 ms (has ArrayBuffer.transfer? false)

is NOT an assertion. Everything is okay and the program can continue without problems.
When malloc() recognizes (e.g. under Linux) that it needs more memory it requests it
(with brk(), mmap() or something similar) and continues without any message. If malloc()
cannot get more memory it returns NULL. In this cases malloc() does not write any message.
I expect the same behavior from C programs when I compile them with emcc.

Please can anybody tell me: What is necessary to get rid of this stupid warning?

Alon Zakai

unread,
Jul 1, 2015, 12:21:58 PM7/1/15
to emscripte...@googlegroups.com
If you build with -O1 or above, and you do not manually enable assertions (you do not include -s ASSERTIONS=1), then the warning will vanish.

I agree that it is a little odd to have warnings be enabled in ASSERTIONS. Perhaps we should have a RUNTIME_WARNINGS option or something like that.

- Alon


mertes...@gmail.com

unread,
Jul 2, 2015, 7:25:14 AM7/2/15
to emscripte...@googlegroups.com
On Wed, Jul 1, 2015 at 18:21:58 UTC+2 Alon Zakai wrote:
If you build with -O1 or above, and you do not manually enable assertions (you do not include -s ASSERTIONS=1), then the warning will vanish.

I agree that it is a little odd to have warnings be enabled in ASSERTIONS. Perhaps we should have a RUNTIME_WARNINGS option or something like that
 
My compiler (emcc) options are:
  -O2 -g -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Winline -Wconversion -Wshadow -Wpointer-arith

and my linker (emcc) options are:
  -Wl,--gc-sections -s ALLOW_MEMORY_GROWTH=1

As you can see I do not use an option like -s ASSERTIONS=1 but I get the warning "Warning: Enlarging memory arrays".
How can that be?
Would an explicit option -s ASSERTIONS=0 help?

As I already said in C there is no concept of RUNTIME_WARNINGS.
The returncode of a function usually tells you if the function worked successful or not.

How should I change the compiler / linker options to get no "runtime warning"?

Alon Zakai

unread,
Jul 2, 2015, 1:12:36 PM7/2/15
to emscripte...@googlegroups.com
You need optimization settings during linking as well. Adding -O2 to your linker options should fix this. See

http://kripken.github.io/emscripten-site/docs/compiling/Building-Projects.html#building-projects-with-optimizations

(Doing -s ASSERTIONS=0 during link would also fix this, but adding -O2 does that automatically.)

Reply all
Reply to author
Forward
0 new messages