In this example, each time I press "Click", 50M of ram is allocated. It is never reclaimed, I can push 30 pages and take up 1.5gb, despite there only ever being 1 page on the nav stack. GC never kicks in. What's going on here?
Flutter (Channel master, 2.1.0-11.0.pre.122, on Microsoft Windows [Version 10.0.18363.1440], locale en-US)
void main() {
runApp(MaterialApp(
home: MemoryTest(),
));
}
class MemoryTest extends StatelessWidget {
final List<EdgeInsets> insets = List.generate(
1000000,
(index) => EdgeInsets.all(0),
);
@override
Widget build(BuildContext context) {
return Container(
color: Colors.white,
child: Column(
children: [
OutlinedButton(
child: Text("CLICK"),
onPressed: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (_) => MemoryTest(),
));
},
),
],
),
);
}
}