1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Flutter] How do I configure DartVM memory growth factor

Discussão em 'Mobile' iniciado por Stack, Outubro 10, 2024 às 04:22.

  1. Stack

    Stack Membro Participativo

    When developing with flutter dart, I found that when applying for memory, the actual memory applied for is much more. For example, the code for applying for memory is as follow:

    class LargeData {
    List<int> _largeList;

    LargeData(int size) : _largeList = List<int>.generate(size, (index) => index);

    List<int> get largeList => _largeList;
    }


    When I called the LargeData function in main.dart, I found that the memory actually requested by DartVM was much larger than what I wanted to apply for, such as:

    LargeData(1000*1000);// When applying for 1M, DartVM actually applied for 5M
    LargeData(10*1000*1000); // When applying for 10M, DartVM actually applied for 40M


    I know that the VM will apply for more memory, but I want to adjust this ratio. For example, when applying for 1M, it actually applies for 2M. Can DartVM configure this coefficient and where to configure it?

    My flutter version is:

    • Flutter 3.22.2 • channel [user-branch] • unknown source
    • Framework • revision 761747bfc5 (4 months ago) • 2024-06-05 22:15:13 +0200
    • Engine • revision edd8546116
    • Tools • Dart 3.4.3 • DevTools 2.34.3

    I expected that by configuring DartVM, when I request 1M of memory in dart code, the VM actually requests 2M, not larger

    Continue reading...

Compartilhe esta Página