-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Closed
Description
Chromium 70 displays a "Aw, Snap!" when writing a file >= 108MB.
#include <stdio.h>
#include <stdlib.h>
#define BUFSIZE 1024*1024
int main(void) {
FILE* f = fopen("/archive.rpa", "w");
unsigned char buf[BUFSIZE] = "";
for (int i = 0; i < BUFSIZE; i++) {
buf[i] = rand() % 256;
}
for (int i = 0; i < 150; i++) { // fails at 108 for me
fwrite(buf, BUFSIZE, 1, f);
}
printf("Wrote file.\n");
}
This is consistent whatever the memory options I provide:
$ emcc ../testlarge.c -o testlarge.html -s TOTAL_MEMORY=1GB -s ALLOW_MEMORY_GROWTH=1
Nothing in the (disconnected) console, but a bit of information on the command line:
<--- Last few GCs --->
arking 47 ms) (average mu = 0.915, current mu = 0.978) finalize incremental[70:0x560853e63640] 1612 ms: Mark-sweep 1721.3 (1725.4) -> 1574.0 (1578.1) MB, 5.0 / 0.0 ms (+ 0.8 ms in 4 steps since start of marking, biggest step 0.6 ms, walltime since start of marking 1216 ms) (average mu = 0.993, current mu = 0.996) allocation[70:0x560853e63640] 1706 ms: Mark-sweep 1574.0 (1578.1) -> 577.5 (581.6) MB, 94.7 / 0.0 ms (average mu = 0.876, current mu = 0.000) allocation failure GC in old space requested
<--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 0x56084ddc86ee]
Security context: 0x06953a021079 <String[21]: http://localhost:8001>
1: write [0x3225aa7a43a1] [http://localhost:8001/testlarge.js:~2400] [pc=0x30bbd6ae1b21](this=0x3225aa7a1d99 <Object map = 0x273c6e0b3851>,0x07eb43631a91 <JSObject>,0x3225aa7a1d51 <Int8Array map = 0x273c6e0a4f81>,6640,1048576,112197632,0x2ffb7b2025b1 <undefined>)
2: write [0x3225aa7a1de1] [http://localhost:8001/testlarge.js:4...
Metadata
Metadata
Assignees
Labels
No labels