Issue 1:
Steps to Reproduce

I write a demo for display 51 image widget in ListView Widget, the image resource are from CDN server, after all the images are showing, the application use 360+M memory, see the picture down there

all the images's size are only 200+ KB far less than 1MB, the image resource urls is in the file ImagesSource.dart.txt

ImagesSource.dart.txt

and my flutter project code in main.dart.txt

main.dart.txt

Also I write a compare demo by iOS native display the same image resources , iOS native just use 70M memory, why the flutter use much bigger memory than iOS native?

and, there also anther problem, in my flutter demo, when click the image widget, the home page will rebuild by calling the setState() function, and the page State build() return a Text Widget instead the ListView widget before, I think the memory will diminish， but the memory keep the same, I try force gc but no effect, how the dart gc work?

Logs

Flutter Doctor

/Users/chaokong/flutterSDK/bin/flutter --no-color doctor
[✓] Flutter (on Mac OS X 10.12.6 16G1036, locale zh-Hans-CN, channel master)
• Flutter at /Users/chaokong/flutterSDK
• Framework revision bdbe53be01 (4 days ago), 2017-11-24 19:13:18 -0800
• Engine revision 93b2179597
• Tools Dart version 1.25.0-dev.11.0

[✓] Android toolchain - develop for Android devices (Android SDK 26.0.2)
• Android SDK at /Users/chaokong/Library/Android/sdk
• Unable to locate Android NDK.

• Unable to locate compiler in Android NDK.

• Platform android-26, build-tools 26.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)

[✓] iOS toolchain - develop for iOS devices (Xcode 9.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 9.1, Build version 9B55
• ios-deploy 1.9.2
• CocoaPods version 1.1.1

[✓] Android Studio (version 3.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)

[✓] IntelliJ IDEA Community Edition (version 2017.2.6)
• Flutter plugin version 19.1
• Dart plugin version 172.4343.25

[✓] Connected devices
• 张伟平的 iPhone • fb87fda18a77f01197d25047bed12a782b21e01f • ios • iOS 11.1
• iPhone X • C598742A-2903-4BE8-A6FF-4168FC8DD581 • ios • iOS 11.1 (simulator)

Process finished with exit code 0

Issue 2:
So I created a custom class and I'm trying to build it with data from Firebase.

I get a Map from firebase and tease it apart with .map() and returning Lists instances of class SocialLink (working merely as a struct).

here's the code

void onProjectValue(void callback(List<Project> projects)){
this.dbRef.child('threads').limitToLast(40).onValue.listen((Event event){
List<Project> projects = [];
Map result = event.snapshot.value;

result.forEach((id, projectData){
projects.add(
new Project(
id: int.parse(id),
title: projectData['thread-scrape']['subject'],
iconUrl: 'http://192.168.1.120:8080/services/twitter.png',
tags: projectData['thread-scrape']['tags'].values.map<String>( (value){
return '$value';
}).toList(), // does this work? yes
links: projectData['links-scrape'].entries.map<SocialLink>( (entry)=>
SocialLink(
iconUrl: this.socialUrls[entry.key],
linkUrl: entry.value
)).toList(), // does this work? no!
views: projectData['thread-scrape']['views']

)
);
});

return callback(projects);
});
}

Problem is I get this error (stack trace)

Launching lib/main.dart on iPhone X in debug mode...
Xcode build done.
CADisplay.name = LCD;
CADisplay.deviceName = PurpleMain;
CADisplay.seed = 1;
tags = 0;
currentMode = <FBSDisplayMode: 0x60c000097700; 375x812@3x (1125x2436/3) 60Hz p3 SDR>;
safeOverscanRatio = {0.89999997615814209, 0.89999997615814209};
nativeCenter = {562.5, 1218};
pixelSize = {1125, 2436};
bounds = {{0, 0}, {375, 812}};
CADisplay = <CADisplay:LCD PurpleMain>;
}
5.4.0 - [Firebase/Analytics][I-ACS023007] Firebase Analytics v.50001000 started
5.4.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/RfcP7r)
[1.1 69498871-3F7C-4F0A-AFCD-4581EDF0C1ED 192.168.1.120.58897<->172.217.3.106:443]
Connected Path: satisfied (Path is satisfied), interface: en1
Duration: 0.281s, DNS @0.001s took 0.040s, TCP @0.043s took 0.044s, TLS took 0.114s
bytes in/out: 3579/1061, packets in/out: 9/10, rtt: 0.043s, retransmitted packets: 0, out-of-order packets: 0
5.4.0 - [Firebase/Core][I-COR000004] App with name when-coin-test does not exist.
[2.1 32DB1D89-B138-4B98-A6D9-B68CC8652D59 192.168.1.120.58905<->172.217.12.138:443]
Connected Path: satisfied (Path is satisfied), interface: en1
Duration: 0.270s, DNS @0.000s took 0.018s, TCP @0.024s took 0.049s, TLS took 0.129s
bytes in/out: 3337/1061, packets in/out: 9/10, rtt: 0.046s, retransmitted packets: 0, out-of-order packets: 0
flutter: connected!
flutter: {Telegram: https://firebasestorage.googleapis.com/v0/b/when-coin-test.appspot.com/o/img%2Ftelegram.png?alt=media&token=dbbd043f-05db-45ca-b00d-50edfe763f95, Medium: https://firebasestorage.googleapis.com/v0/b/when-coin-test.appspot.com/o/img%2Fmedium.png?alt=media&token=15267fc3-f112-4fa1-9e6c-facbe787e68d, YouTube: https://firebasestorage.googleapis.com/v0/b/when-coin-test.appspot.com/o/img%2Fyoutube.png?alt=media&token=4de33db4-ec85-47d0-9a9e-952479bdb761, GitHub: https://firebasestorage.googleapis.com/v0/b/when-coin-test.appspot.com/o/img%2Fgithub.png?alt=media&token=403440df-65e3-4c1b-8ac8-a8bed7ea2f4c, Steemit: https://firebasestorage.googleapis.com/v0/b/when-coin-test.appspot.com/o/img%2Fsteemit.png?alt=media&token=308f7f2d-0120-454d-b2f7-415d13f57106, Slack: https://firebasestorage.googleapis.com/v0/b/when-coin-test.appspot.com/o/img%2Fslack.png?alt=media&token=6dfa1b2b-33a5-4820-a167-05d25e9c743a, Facebook: https://firebasestorage.googleapis.com/v0/b/when-coin-test.appspot.com/<…>
compiler message: Unhandled exception:
compiler message: NoSuchMethodError: The getter 'className' was called on null.
compiler message: Receiver: null
compiler message: Tried calling: className
compiler message: #0 Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:46:5)
compiler message: #1 serializeProcedure (package:front_end/src/fasta/kernel/utils.dart:82:29)
compiler message: #2 FrontendCompiler.compileExpression (package:vm/frontend_server.dart:452:16)
compiler message: <asynchronous suspension>
compiler message: #3 _FlutterFrontendCompiler.compileExpression (package:frontend_server/server.dart:55:22)
compiler message: #4 listenAndCompile.<anonymous closure> (package:vm/frontend_server.dart:650:20)
compiler message: <asynchronous suspension>
compiler message: #5 _RootZone.runUnaryGuarded (dart:async/zone.dart:1316:10)
compiler message: #6 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
compiler message: #7 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
compiler message: #8 _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:68:11)
compiler message: #9 _EventSinkWrapper.add (dart:async/stream_transformers.dart:15:11)
compiler message: #10 _StringAdapterSink.add (dart:convert/string_conversion.dart:268:11)
compiler message: #11 _LineSplitterSink._addLines (dart:convert/line_splitter.dart:154:13)
compiler message: #12 _LineSplitterSink.addSlice (dart:convert/line_splitter.dart:129:5)
compiler message: #13 StringConversionSinkMixin.add (dart:convert/string_conversion.dart:189:5)
compiler message: #14 _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:120:24)
compiler message: #15 _RootZone.runUnaryGuarded (dart:async/zone.dart:1316:10)
compiler message: #16 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
compiler message: #17 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
compiler message: #18 _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:68:11)
compiler message: #19 _EventSinkWrapper.add (dart:async/stream_transformers.dart:15:11)
compiler message: #20 _StringAdapterSink.add (dart:convert/string_conversion.dart:268:11)
compiler message: #21 _StringAdapterSink.addSlice (dart:convert/string_conversion.dart:273:7)
compiler message: #22 _Utf8ConversionSink.addSlice (dart:convert/string_conversion.dart:348:20)
compiler message: #23 _Utf8ConversionSink.add (dart:convert/string_conversion.dart:341:5)
compiler message: #24 _ConverterStreamEventSink.add (dart:convert/chunked_conversion.dart:86:18)
compiler message: #25 _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:120:24)
compiler message: #26 _RootZone.runUnaryGuarded (dart:async/zone.dart:1316:10)
compiler message: #27 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
compiler message: #28 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
compiler message: #29 _SyncStreamController._sendData (dart:async/stream_controller.dart:763:19)
compiler message: #30 _StreamController._add (dart:async/stream_controller.dart:639:7)
compiler message: #31 _StreamController.add (dart:async/stream_controller.dart:585:5)
compiler message: #32 _Socket._onData (dart:io/runtime/binsocket_patch.dart:1714:41)
compiler message: #33 _RootZone.runUnaryGuarded (dart:async/zone.dart:1316:10)
compiler message: #34 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
compiler message: #35 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
compiler message: #36 _SyncStreamController._sendData (dart:async/stream_controller.dart:763:19)
compiler message: #37 _StreamController._add (dart:async/stream_controller.dart:639:7)
compiler message: #38 _StreamController.add (dart:async/stream_controller.dart:585:5)
compiler message: #39 new _RawSocket.<anonymous closure> (dart:io/runtime/binsocket_patch.dart:1276:33)
compiler message: #40 _NativeSocket.issueReadEvent.issue (dart:io/runtime/binsocket_patch.dart:819:14)
compiler message: #41 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
compiler message: #42 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
compiler message: #43 _runPendingImmediateCallback (dart:isolate/runtime/libisolate_patch.dart:113:13)
compiler message: #44 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:166:5)
Unhandled exception:
SocketException: Write failed (OS Error: Broken pipe, errno = 32), port = 0
#0 _rootHandleUncaughtError.<anonymous closure> (dart:async/zone.dart:1114:29)
#1 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#2 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#3 _runPendingImmediateCallback (dart:isolate/runtime/libisolate_patch.dart:113:13)
#4 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:166:5)
Exited (255)