{"action":"closed","issue":{"url":"https://api.github.com/repos/dart-lang/sdk/issues/27663","repository_url":"https://api.github.com/repos/dart-lang/sdk","labels_url":"https://api.github.com/repos/dart-lang/sdk/issues/27663/labels{/name}","comments_url":"https://api.github.com/repos/dart-lang/sdk/issues/27663/comments","events_url":"https://api.github.com/repos/dart-lang/sdk/issues/27663/events","html_url":"https://github.com/dart-lang/sdk/issues/27663","id":184983111,"number":27663,"title":"In Flutter, Object.runtimeType allocates thousands of objects (straight into the old generation so they rarely get GC'ed)","user":{"login":"Hixie","id":551196,"avatar_url":"https://avatars.githubusercontent.com/u/551196?v=3","gravatar_id":"","url":"https://api.github.com/users/Hixie","html_url":"https://github.com/Hixie","followers_url":"https://api.github.com/users/Hixie/followers","following_url":"https://api.github.com/users/Hixie/following{/other_user}","gists_url":"https://api.github.com/users/Hixie/gists{/gist_id}","starred_url":"https://api.github.com/users/Hixie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hixie/subscriptions","organizations_url":"https://api.github.com/users/Hixie/orgs","repos_url":"https://api.github.com/users/Hixie/repos","events_url":"https://api.github.com/users/Hixie/events{/privacy}","received_events_url":"https://api.github.com/users/Hixie/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dart-lang/sdk/labels/area-vm","name":"area-vm","color":"c7def8"}],"state":"closed","locked":false,"assignee":{"login":"crelier","id":8620091,"avatar_url":"https://avatars.githubusercontent.com/u/8620091?v=3","gravatar_id":"","url":"https://api.github.com/users/crelier","html_url":"https://github.com/crelier","followers_url":"https://api.github.com/users/crelier/followers","following_url":"https://api.github.com/users/crelier/following{/other_user}","gists_url":"https://api.github.com/users/crelier/gists{/gist_id}","starred_url":"https://api.github.com/users/crelier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crelier/subscriptions","organizations_url":"https://api.github.com/users/crelier/orgs","repos_url":"https://api.github.com/users/crelier/repos","events_url":"https://api.github.com/users/crelier/events{/privacy}","received_events_url":"https://api.github.com/users/crelier/received_events","type":"User","site_admin":false},"assignees":[{"login":"crelier","id":8620091,"avatar_url":"https://avatars.githubusercontent.com/u/8620091?v=3","gravatar_id":"","url":"https://api.github.com/users/crelier","html_url":"https://github.com/crelier","followers_url":"https://api.github.com/users/crelier/followers","following_url":"https://api.github.com/users/crelier/following{/other_user}","gists_url":"https://api.github.com/users/crelier/gists{/gist_id}","starred_url":"https://api.github.com/users/crelier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crelier/subscriptions","organizations_url":"https://api.github.com/users/crelier/orgs","repos_url":"https://api.github.com/users/crelier/repos","events_url":"https://api.github.com/users/crelier/events{/privacy}","received_events_url":"https://api.github.com/users/crelier/received_events","type":"User","site_admin":false}],"milestone":null,"comments":5,"created_at":"2016-10-24T23:42:20Z","updated_at":"2016-10-25T11:56:54Z","closed_at":"2016-10-25T11:56:54Z","body":"When running a Flutter application that animates continually and creates a lot of new widgets each frame, Flutter calls runtimeType many times. This results (according to the Allocation Profile in Observatory) in many hundreds of _Type objects being allocated per second. They go straight into the old GC generation so we allocate megabytes of these before GC kicks in to get rid of them.\r\n\r\nHere's a sample Flutter app that tickles this scenario. To use it, run `flutter create`, then replace the `main.dart` it created with the code below and run `flutter run`.\r\n\r\n```dart\r\nimport 'package:flutter/material.dart';\r\n\r\nvoid main() {\r\n  runApp(new MyHomePage());\r\n}\r\n\r\nclass MyHomePage extends StatefulWidget {\r\n  MyHomePage({Key key}) : super(key: key);\r\n\r\n  @override\r\n  _MyHomePageState createState() => new _MyHomePageState();\r\n}\r\n\r\nclass _MyHomePageState extends State<MyHomePage> with SingleTickerProviderStateMixin {\r\n\r\n  Animation<double> _animation;\r\n\r\n  void initState() {\r\n    _animation = new AnimationController(\r\n      lowerBound: 0.0,\r\n      upperBound: 100.0,\r\n      duration:\tconst Duration(seconds: 10),\r\n      vsync: this,\r\n    )..addListener(() { setState(() { }); })\r\n     ..repeat();\r\n  }\r\n\r\n  @override\r\n  Widget build(BuildContext context) {\r\n   return new MaterialApp(\r\n     home: new Scaffold(\r\n       appBar: new AppBar(\r\n         title: new Text('Demo'),\r\n       ),\r\n       body: new Stack(\r\n         children: <Widget>[\r\n           new Positioned(\r\n             top: _animation.value,\r\n             left: 10.0,\r\n             right: 10.0,\r\n             child: new Text('Animating...'),\r\n           ),\r\n         ],\r\n       ),\r\n     ),\r\n   );\r\n  }\r\n}\r\n```"}}
{"actor":{"display_login":"crelier"}}