Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array buffer allocation failed #14

Open
miherlosev opened this issue Jan 26, 2017 · 1 comment
Open

Array buffer allocation failed #14

miherlosev opened this issue Jan 26, 2017 · 1 comment

Comments

@miherlosev
Copy link

miherlosev commented Jan 26, 2017

I get the error Array buffer allocation failed on machine that used for continious integration.
Machine parameters: Windows10, 1GB, 1 CPU.

I reseached code and found the strange code in build/encode.js:

for (var I, P, J, ta, K, ua, L, N, va = 0, B = 0, wa = 0, z = 0, xa = 0, ya = 0, C = 0, za = b.TOTAL_STACK || 5242880, D = b.TOTAL_MEMORY || 318767104, R = 65536; R < D || R < 2 * za; )
	R = 16777216 > R ? 2 * R : R + 16777216;
R !== D && (D = R);
assert("undefined" !== typeof Int32Array && "undefined" !== typeof Float64Array && !!(new Int32Array(1)).subarray && !!(new Int32Array(1)).set, "JS engine does not provide full typed array support");
var buffer;
buffer = new ArrayBuffer(D); //D equals 318767104 - 304 * 1024 * 1024
...

Why does your module allocate in loop 304 Mb?
It is very strange because V8 has limit 512 Mb for x86.

@k-meiser
Copy link

From what I see, the source is the constant TOTAL_MEMORY=318767104 in the Makefile in the root of https://github.com/foliojs/brotli.js that uses emcc to port https://github.com/google/brotli to the build/encode.js

For serverless solutions this proves an issue as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants