Open Kuroketsu opened 2 months ago
Hi @Kuroketsu 👋 Based on the error it looks like your windows machine is out of memory. Can you check to make sure your machine has enough memory to spawn a new isolated? Are you able to run other dart programs or flutter apps on the same machine?
Hello @felangel , thank you for the fast response.
My windows pc has 16gb ram and while running the mason make command the dart eats all my available memory (~10gb). It starts up low (~400mb) then it becomes bigger and bigger until it eats all my available memory. I know for sure that this is from the mason make command because when I cancel the command the occupied memory is released.
This should not be happening right?
@Kuroketsu yeah that should definitely not be happening. Are you able to provide detailed reproduction steps? I'd need to try to reproduce on a windows machine, thanks!
@felangel I tried to reproduce the issue again.
Steps To Reproduce:
flutter create example_app
mason new example_brick --hooks
import 'dart:io';
import 'package:mason/mason.dart';
Future
await Process.run( 'flutter', ['pub', 'add', 'dio'], runInShell: true, );
await Process.run( 'flutter', ['pub', 'get'], runInShell: true, );
progress.complete(); context.logger.success('Done instaling packages!'); }
5. use brick on the flutter project
@felangel I tried to reproduce the issue again.
Steps To Reproduce:
- run
flutter create example_app
- create mason folder
- use mason_cli 0.1.0-dev.56 to send command
mason new example_brick --hooks
- update hooks/pre_gen.dart to this:
import 'dart:io'; import 'package:mason/mason.dart'; Future<void> run(HookContext context) async { final progress = context.logger.progress('Installing Packages'); await Process.run( 'flutter', ['pub', 'add', 'dio'], runInShell: true, ); await Process.run( 'flutter', ['pub', 'get'], runInShell: true, ); progress.complete(); context.logger.success('Done instaling packages!'); }
- use brick on the flutter project
Thanks for the context. Can you elaborate on step 5? What command are you running to use the brick on the flutter project? Thanks!
I simply added the brick to the mason.yaml file, then run command mason get
then mason make example_brick
.
Description
I have a brick from github that has pre_gen hooks that runs flutter pub add dio, but when I run mason make the terminal is just stuck and based on windows task manager the dart eats all of my PC's available ram.
Steps To Reproduce
import 'package:mason/mason.dart';
Future run(HookContext context) async {
final progress = context.logger.progress('Installing Packages');
await Process.run( 'flutter', ['pub', 'add', 'dio'], runInShell: true, );
await Process.run( 'flutter', ['pub', 'get'], runInShell: true, );
progress.complete(); context.logger.success('Done instaling packages!'); }
evacuation failed evacuation failed evacuation failed evacuation failed Exhausted heap space, trying to allocate 81712 bytes. Exhausted heap space, trying to allocate 524368 bytes. Exhausted heap space, trying to allocate 524368 bytes. ✓ Compiled pre_gen.dart (3.5s) evacuation failed evacuation failed evacuation failed evacuation failed Exhausted heap space, trying to allocate 53936 bytes. Exhausted heap space, trying to allocate 524368 bytes. Exhausted heap space, trying to allocate 524368 bytes. An exception occurred while executing hook: C:/Users/Ralph/AppData/Local/Mason/Cache/git/thinkbit_mason_bricks_aHR0cHM6Ly9naXRodWIuY29tL0t1cm9rZXRzdS90aGlua2JpdF9tYXNvbl9icmlja3MuZ2l0_23d781d75947c04a4c819f23937609eb84133637/brick s/api_service\hooks\pre_gen.dart. Error: Unable to spawn isolate: Out of Memory
0 _StreamSinkImpl.add (dart:io/io_sink.dart:154:5)
1 _IOSinkImpl.write (dart:io/io_sink.dart:287:5)
2 _StdSink._write (dart:io/stdio.dart:401:13)
3 _StdSink.write (dart:io/stdio.dart:416:33)
4 reportCrash.note (package:front_end/src/base/crash.dart:66:12)
5 reportCrash (package:front_end/src/base/crash.dart:116:11)
6 withCrashReporting (package:front_end/src/base/crash.dart:146:12)
7 _rootRunBinary (dart:async/zone.dart:1423:47)
8 _CustomZone.runBinary (dart:async/zone.dart:1315:19)
9 _FutureListener.handleError (dart:async/future_impl.dart:178:22)
10 Future._propagateToListeners.handleError (dart:async/future_impl.dart:873:47)
11 Future._propagateToListeners (dart:async/future_impl.dart:894:13)
12 Future._completeError (dart:async/future_impl.dart:674:5)
13 _rootRunBinary (dart:async/zone.dart:1423:47)
14 _CustomZone.runBinary (dart:async/zone.dart:1315:19)
15 _FutureListener.handleError (dart:async/future_impl.dart:178:22)
16 Future._propagateToListeners.handleError (dart:async/future_impl.dart:873:47)
17 Future._propagateToListeners (dart:async/future_impl.dart:894:13)
18 Future._completeError (dart:async/future_impl.dart:674:5)
19 _rootRunBinary (dart:async/zone.dart:1423:47)
20 _CustomZone.runBinary (dart:async/zone.dart:1315:19)
21 _FutureListener.handleError (dart:async/future_impl.dart:178:22)
22 Future._propagateToListeners.handleError (dart:async/future_impl.dart:873:47)
23 Future._propagateToListeners (dart:async/future_impl.dart:894:13)
24 Future._completeError (dart:async/future_impl.dart:674:5)
25 _rootRunBinary (dart:async/zone.dart:1423:47)
26 _CustomZone.runBinary (dart:async/zone.dart:1315:19)
27 _FutureListener.handleError (dart:async/future_impl.dart:178:22)
28 Future._propagateToListeners.handleError (dart:async/future_impl.dart:873:47)
29 Future._propagateToListeners (dart:async/future_impl.dart:894:13)
30 Future._completeError (dart:async/future_impl.dart:674:5)
31 _rootRunUnary (dart:async/zone.dart:1407:47)
32 _CustomZone.runUnary (dart:async/zone.dart:1308:19)
33 _FutureListener.handleValue (dart:async/future_impl.dart:163:18)
34 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:861:45)
35 Future._propagateToListeners (dart:async/future_impl.dart:890:13)
36 Future._completeWithValue (dart:async/future_impl.dart:666:5)
37 Future._asyncCompleteWithValue. (dart:async/future_impl.dart:736:7)
38 _rootRun (dart:async/zone.dart:1399:13)
39 _CustomZone.run (dart:async/zone.dart:1301:19)
40 _CustomZone.bindCallback. (dart:async/zone.dart:1233:23)
41 _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
42 _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
43 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
44 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:405:11)
45 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5)
46 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
[√] Flutter (Channel stable, 3.24.0, on Microsoft Windows [Version 10.0.19045.4780], locale en-US) • Flutter version 3.24.0 on channel stable at C:\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 80c2e84975 (3 weeks ago), 2024-07-30 23:06:49 +0700 • Engine revision b8800d88be • Dart version 3.5.0 • DevTools version 2.37.2
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.1) • Android SDK at C:\Users\Ralph\AppData\Local\Android\Sdk • Platform android-34, build-tools 33.0.1 • ANDROID_HOME = C:\Users\Ralph\AppData\Local\Android\Sdk • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java • Java version OpenJDK Runtime Environment (build 17.0.10+0--11572160) • All Android licenses accepted.
[√] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.10.1) • Visual Studio at D:\Program Files\Visual Studio • Visual Studio Community 2022 version 17.10.34928.147 • Windows 10 SDK version 10.0.22621.0
[√] Android Studio (version 2023.3) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.10+0--11572160)
[√] VS Code (version 1.92.2) • VS Code at C:\Users\Ralph\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.94.0
[√] Connected device (3 available) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19045.4780] • Chrome (web) • chrome • web-javascript • Google Chrome 127.0.6533.122 • Edge (web) • edge • web-javascript • Microsoft Edge 127.0.2651.74
[√] Network resources • All expected network resources are available.
• No issues found!