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

CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory #2168

Closed
vchimev opened this issue Oct 27, 2016 · 7 comments
Closed

CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory #2168

vchimev opened this issue Oct 27, 2016 · 7 comments
Labels
Milestone

Comments

@vchimev
Copy link

vchimev commented Oct 27, 2016

Tell us about the problem

The tns livesync android --watch command throws a fatal error while syncing an application:
https://gist.github.com/vchimev/ff09a52344deeda9ab8726b393856145
https://gist.github.com/vchimev/a6432699227d7faa99e2a1b00e2bc396
https://gist.github.com/vchimev/ebb14fa5f8bec922ea8b8c3008f0977a
https://gist.github.com/vchimev/62e757711b27d9a82605f781fea265ad

Please provide the following version numbers that your issue occurs with:

  • CLI: 2.5.0-2016-10-27-6956
  • Cross-platform modules: 2.5.0-2016-10-26-4569
  • Android runtime: 2.5.0-next-2016-10-26-1317

Please tell us how to recreate the issue in as much detail as possible.

App: https://github.com/NativeScript/NativeScript/tree/master/apps
Emulator: Api 24 - Intel x86 Atom System Image

Change the apps/app/ui-tests-app/flexbox/flexbox.ts file.
It seems that something during

Hook completed
7:10:13 PM - File change detected. Starting incremental compilation...

causes the error.

@slavchev
Copy link

According this stackoverflow thread the problem may be allocating too much memory. Here is the suggested sollution

node --max_old_space_size=4096 yourFile.js

I am not sure how we can test it in the context of tns without manual editing the file.

@vchimev
Copy link
Author

vchimev commented Nov 2, 2016

The fix will be included in nativescript-dev-typescript@0.3.3.

@alansousa
Copy link

I'm using nativescript-dev-typescript@0.3.5, and all libs up to date, and it isn't working, I'm getting the same error.
And I have only 4gb of RAM

@alansousa
Copy link

I saw that my problem was, of course, my 32bits environment, so I change 'native-dev-typescript\lib\compiler.js' to set '--max_old_space_size=4096' to '--max_old_space_size=2048'
and set JAVA_OPTS = -Xms1024m -Xmx1024m -XX:NewSize=256m -XX:MaxNewSize=356m -XX:PermSize=256m -XX:MaxPermSize=356m.

It works to me!

@trivediri2312
Copy link

trivediri2312 commented Sep 23, 2017

alansousa hi bro can you plz tell where you have set JAVA_OPTS = -Xms1024m -Xmx1024m -XX:NewSize=256m -XX:MaxNewSize=356m -XX:PermSize=256m -XX:MaxPermSize=356m
I am still getting error althogh i have set 'native-dev-typescript\lib\compiler.js' to set '--max_old_space_size=4096' to '--max_old_space_size=2048'

@RadouaneRoufid
Copy link

Solution that worked for me :

webpack.config.js

if (uglify) {
        config.plugins.push(new webpack.LoaderOptionsPlugin({ minimize: true }));

        // Work around an Android issue by setting compress = false
        const compress = platform !== "android";

        config.plugins.push(new UglifyJsPlugin({
            parallel: true,
            uglifyOptions: {
                mangle: { reserved: nsWebpack.uglifyMangleExcludes },
                compress,
            },
            cache: join(__dirname, 'webpack-cache/uglify-cache')
        }));
    }

The build time is even faster !

@acharyaks90
Copy link

Hi all i also got same error but not solved by all above then
I updated the NS-Webpack plugin version to latest i solved my problem

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

No branches or pull requests

7 participants