I'm working on my flutter app, and the most recent size report I got is: 219 MB,
by running this command:
flutter build apk --analyze-size --target-platform=android-arm64
clearly, 219 MB size is TOO BIG for me, although I did checked out some tutorials online to reduce the app size, but none of seem effective, so I decided to REALLY dive into this topic, and here are my questions:
Does adding more packages to my app really increase my app size?
If the packages are the same, but I import them to more files, does that effect my app size?
If I increase my widgets and screens, does that increase the app size?
If numbers of widgets are the same, but I sperate (extract widget) them into different files, will the app size increase?
Does the app size that the command returns (above) really reflect my app size in the real world when I publish it?
What are the factors of app size (numbers of widgets, files, or packages)
And here is the analysis:
✓ Built build/app/outputs/flutter-apk/app-release.apk (219.5MB).
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
app-release.apk (total compressed) 219 MB
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
res/
interpolator 1 KB
drawable-hdpi-v4 21 KB
drawable-xxhdpi-v4 33 KB
drawable 16 KB
drawable-xhdpi-v4 25 KB
drawable-mdpi-v4 16 KB
drawable-xxxhdpi-v4 26 KB
color-v23 2 KB
color 3 KB
anim 8 KB
layout 21 KB
drawable-anydpi-v21 2 KB
drawable-ldrtl-xxxhdpi-v17 2 KB
layout-v21 2 KB
drawable-v21 2 KB
drawable-ldrtl-xhdpi-v17 1 KB
drawable-ldrtl-xxhdpi-v17 1 KB
layout-watch-v20 1020 B
mipmap-xxxhdpi-v4 1 KB
raw 1 MB
META-INF/
CERT.SF 34 KB
kotlin-stdlib.kotlin_module 1 KB
CERT.RSA 1016 B
MANIFEST.MF 31 KB
lib/
x86 45 MB
armeabi-v7a 58 MB
arm64-v8a 59 MB
Dart AOT symbols accounted decompressed size 8 MB
package:flutter 3 MB
package:cheese 605 KB
dart:core 389 KB
package:rive 320 KB
dart:io 278 KB
dart:typed_data 265 KB
dart:ui 247 KB
dart:collection 189 KB
dart:async 177 KB
package:flutter_svg 143 KB
package:just_audio/
just_audio.dart 77 KB
dart:convert 76 KB
package:sqflite_common 70 KB
package:vector_math 66 KB
package:petitparser 65 KB
package:photo_view 59 KB
package:source_span 58 KB
package:xml 52 KB
package:cloud_firestore_platform_interface 51 KB
package:rxdart 46 KB
x86_64 52 MB
kotlin/
reflect 2 KB
collections 1 KB
kotlin.kotlin_builtins 4 KB
assets/
flutter_assets 237 KB
IAgoraMediaEngine.h 7 KB
AgoraBase.h 8 KB
IAgoraRtcEngine.h 85 KB
IAgoraRtcChannel.h 16 KB
google/
protobuf 21 KB
resources.arsc 405 KB
okhttp3/
internal 33 KB
AndroidManifest.xml 4 KB
classes2.dex 747 KB
classes.dex 3 MB
I have tons of widgets but I have no idea how to reduce any of them, so PLEASE HELP!!!
Related
I have Centos installed on a server with 64gb memory and it seems as if the memory usage is being suppressed.
I came to this conclusion by running an insert statement where I insert 10million rows into a Postgres table in both a Timescaledb and a standard Postgres instance hosted on Docker.
I monitored the insert process in three different ways:
Docker stats timescaledb:
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
timescaledb 73.14% 10.42 MiB / 62.75 GiB 0.02% 8.46 kB / 8.39 kB 0 B / 15.1 GB 12
free -i gives the following:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
16298 avahi 20 0 16.2g 762356 759908 R 41.5 1.2 0:22.72 postgres
16127 avahi 20 0 16.2g 693080 691968 S 4.3 1.1 0:01.29 postgres
16129 avahi 20 0 16.2g 17748 16712 S 2.3 0.0 0:00.87 postgres
1578 root 30 10 1232780 86976 11568 S 0.7 0.1 0:46.34 osqueryd
17014 root 20 0 162264 2480 1596 R 0.7 0.0 0:00.03 top
928 root 20 0 90608 3212 2352 S 0.3 0.0 0:03.47 rngd
16128 avahi 20 0 16.2g 132064 131016 S 0.3 0.2 0:00.18 postgres
free -h gives the following
total used free shared buff/cache available
Mem: 62G 1.0G 58G 1.1G 3.1G 56G
Swap: 62G 0B 62G
I know that Timescaledb is an extension of Postgres which comes with its own memory configurations, but the Docker container of Timescaledb configures these automatically for you (for instance effective cache size is set at 48gb as opposed to the default 4gb that Postgres ships with). I also ran a similar process with Apache spark with 16gb assigned to the worker and it ran into an oom error. Additionally, I did a similar test on a different smaller VM and the memory usage increased as expected. All of this leads me to believe that it's a Centos config setting that I am missing somewhere, and nothing to do with Timescale/Postgres?
I have added the following parameters to vm.overcommit_memory = 2 and vm.overcommit_ratio = 95 in /etc/sysctl.conf and ran sysctl -p to implement the settings, but this didn't make a difference.
kernel.shmall = 8224280
kernel.shmmax = 33686650880
kernel.shmmni = 4096
vm.overcommit_memory = 2
vm.overcommit_ratio = 95
Below is the output from cat /proc/meminfo
MemTotal: 65794240 kB
MemFree: 61098656 kB
MemAvailable: 59252660 kB
Buffers: 2120 kB
Cached: 3467144 kB
SwapCached: 0 kB
Active: 2817620 kB
Inactive: 884816 kB
Active(anon): 1109220 kB
Inactive(anon): 234708 kB
Active(file): 1708400 kB
Inactive(file): 650108 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 65535996 kB
SwapFree: 65535996 kB
Dirty: 88 kB
Writeback: 0 kB
AnonPages: 233188 kB
Mapped: 1175120 kB
Shmem: 1110756 kB
Slab: 204044 kB
SReclaimable: 142700 kB
SUnreclaim: 61344 kB
KernelStack: 7232 kB
PageTables: 14672 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 128040524 kB
Committed_AS: 18709300 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 408824 kB
VmallocChunk: 34325399548 kB
Percpu: 9216 kB
HardwareCorrupted: 0 kB
AnonHugePages: 96256 kB
CmaTotal: 0 kB
CmaFree: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 133604 kB
DirectMap2M: 66965504 kB
Is there maybe something I can try to increase my memory usage? Is there maybe a config setting that I am missing somehere?
Thanks in advance for any help
PostgreSQL also uses "unused" memory, because it uses buffered I/O. So this "unused memory" is used by the kernel to cache files – in the case of a database server, these will be database files. That way, I/O requests by PostgreSQL can be served from the kernel cache rather than causing disk I/O requests.
Can anyone tell me how do I reduce this apk size?
Some major contributors are classes.dex(3MB), Dart AOT symbols(6MB) and audience_network.dex(1MB).
The same applicative using native android can be built in just 4-5MB
Here are the results of --analyze-size.
C:\Users\arunc\AndroidStudioProjects\bonaza>flutter build apk --target-platform android-arm64 --release --analyze-size
Running "flutter pub get" in miband5... 1,807ms
Building without sound null safety
For more information see https://dart.dev/null-safety/unsound-null-safety\
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: C:\src\flutter\flutter.pub-cache\hosted\pub.dartlang.org\permission_handler-5.0.1+1\android\src\main\java\com\baseflow\permissionhandler\PermissionHandlerPlugin.java u
ses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 124.9s
√ Built build\app\outputs\flutter-apk\app-release.apk (12.5MB).
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
app-release.apk (total compressed) 13 MB
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
res/
drawable-anydpi-v21 8 KB
interpolator 1 KB
drawable-xxhdpi-v4 56 KB
drawable-hdpi-v4 33 KB
drawable 21 KB
drawable-anydpi-v24 2 KB
drawable-mdpi-v4 24 KB
color-v23 2 KB
drawable-xhdpi-v4 40 KB
drawable-ldpi-v4 6 KB
color 5 KB
mipmap-hdpi-v4 19 KB
layout 28 KB
anim 8 KB
drawable-xxxhdpi-v4 48 KB
mipmap-xxxhdpi-v4 88 KB
mipmap-xhdpi-v4 29 KB
mipmap-xxhdpi-v4 55 KB
drawable-ldrtl-xxxhdpi-v17 2 KB
mipmap-mdpi-v4 10 KB
drawable-v21 2 KB
drawable-ldrtl-xhdpi-v17 1 KB
drawable-ldrtl-xxhdpi-v17 1 KB
layout-watch-v20 1022 B
layout-v21 2 KB
META-INF/
CERT.SF 36 KB
kotlin-stdlib.kotlin_module 1 KB
MANIFEST.MF 32 KB
CERT.RSA 1 KB
assets/
flutter_assets 69 KB
audience_network.dex 1 MB
kotlin/
kotlin.kotlin_builtins 4 KB
reflect 2 KB
collections 1 KB
AndroidManifest.xml 6 KB
classes.dex 3 MB
resources.arsc 664 KB
lib/
arm64-v8a 6 MB
Dart AOT symbols accounted decompressed size 6 MB
package:flutter 3 MB
dart:core 405 KB
dart:typed_data 273 KB
dart:io 253 KB
dart:ui 215 KB
dart:async 173 KB
dart:collection 165 KB
package:miband5 152 KB
package:parse_server_sdk 122 KB
package:flutter_gen 122 KB
package:flutter_localizations 106 KB
package:flutter_cache_manager 102 KB
dart:convert 83 KB
package:sqflite_common 73 KB
package:source_span 63 KB
package:win32 53 KB
package:intl 50 KB
dart:isolate 39 KB
package:vector_math 34 KB
package:google_mobile_ads 29 KB
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
A summary of your APK analysis can be found at: C:\Users\arunc.flutter-devtools\apk-code-size-analysis_09.json
run flutter clean
run flutter pub get
run flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
after running third commmand you'll get seprate apk's for android-arm , android-arm64 , android-x64 which reduces the apk's size.
I have an ahk script I use to enable the Printer button on a Crystal Reports dialog that for what ever reason is not enabled by default when used in Server 2008 R2. Anyways... the issue I am having is the process when running continues to stack memory each cycle. Its not like I am storing any contents to a variable that happens to not get cleared. What in this process uses memory resources that don't get released and is there anything I can implement to prevent this from happening?
You can see in this listing that the private memory just grows as usage goes on. I ended up having it initiate about 5 times and it went from about 1000k to 2000k.
The top entry is my test version I converted from WinWaitActive that was causing unnecessary CPU usage.
Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
58 8 2312 6216 68 0.62 7828 showprinterbutton
55 8 1788 5508 67 32.39 6840 ShowPSPrinter
57 8 1864 6028 79 33.12 7184 ShowPSPrinter
55 8 1396 5084 67 1.29 7604 ShowPSPrinter
55 8 1796 5536 67 36.36 7856 ShowPSPrinter
55 8 1772 5444 67 37.27 9848 ShowPSPrinter
55 8 1740 5424 67 26.33 10300 ShowPSPrinter
55 8 1396 4992 67 0.84 11348 ShowPSPrinter
55 8 1396 5024 67 1.14 11460 ShowPSPrinter
55 8 1736 5604 67 355.93 11676 ShowPSPrinter
55 8 1396 4984 67 1.06 13364 ShowPSPrinter
55 8 1396 5132 67 0.81 13516 ShowPSPrinter
72 9 2048 6500 73 66.36 14072 ShowPSPrinter
55 8 1792 5504 67 59.92 15736 ShowPSPrinter
55 8 1400 4960 67 0.61 16340 ShowPSPrinter
57 8 1496 5848 79 0.98 18516 ShowPSPrinter
57 8 1500 5404 79 0.98 19048 ShowPSPrinter
55 8 1400 5000 67 0.51 22020 ShowPSPrinter
Here is the script contents I have that is then compiled to run as an EXE.
; Version: 1.2
; Dated: 03/31/2015 - Created
; Description: Enable a watch for page setup dialog and activate the print button for crystal reports
; Only allow one instance to run
#SingleInstance force
; Run with out a tray icon
#NoTrayIcon
; Getting loose with not requiring direct title menu values
SetTitleMatchMode, RegEx
; Start active watch for quick post menu
WaitForPS:
WinWait,Page Setup
{
Control,Show,,Button8,Page Setup,(optimize for screen display)
GoSub WaitForPS
}
; End of Script...
Right after the moment the window appears and the loop ran one time, WainWait immediately continues to the next statement because the window already exists, enables the control, and recursively invokes the loop again (gosub), so the code allocated for example 100 stack frames per second thus eventually exhausting the call stack.
Instead use an indefinite loop and before continuing wait for the window to close:
Loop
{
WinWait,Page Setup
Control,Show,,Button8,Page Setup,(optimize for screen display)
WinWaitClose
}
I have a very annyoing problem when running TigerVNC 1.3.1 in a Debian 7 virtual machine. After about one minute doing nothing in the VNC window, the Xvnc process goes up to 100% CPU usage. Once I move my mouse into the VNC window again, the CPU usage returns to normal. I believe that the function call select() is the culprit. Doing an "strace -p " gives me tons of this:
select(256, [0 1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74], NULL, NULL, {0, 0}) = 0 (Timeout)
And "strace -c -p ":
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
78.19 0.001760 0 98445 select
21.81 0.000491 0 196889 setitimer
------ ----------- ----------- --------- --------- ----------------
100.00 0.002251 295334 total
I'm not an expert on system function calls, but all other processes I checked with these commands do not show that kind of behavior. Is it a bug in the tigervnc code or is there a way I can fix it?
I'd recommend you reset to default settings to see if everything becomes fine. I was a tightvnc user for a long time, until I switched to RealVNC (free edition). I'd suggest you give a try of it. The settings are almost identical to tightvnc. And it supports real cross machine text copy-and-paste.
It seems to be absent from the MS public symbol store, but it is also absent from the C:\Windows\System32 folder.
My symbol path is configured correctly, because I do get symbols for kernel32.dll and alike downloaded from the MS public symbol store and recognized by windbg.
It looks like the PDB is missing the MSI's. It used to be in MSI's for the earlier versions back to 4.1. But since going to 6.2 (part of Windows 7\8 SDK), the MSI's to not have the private PDBs.
Still looking...
FILE TABLE from Application Verifier x64 External Package-x64_en-us.msi
vfluapriv.dll 281656 6.2.9200.16384 1033 512 35
vfluapriv.dll 242776 6.2.9200.16384 1033 512 25
catdc3acb184552e9eeac50269425274d3c.cat 9783 512 29
vfprintpthelper.dll 711320 6.2.9200.16384 1033 512 36
appverif.chm 657331 512 15
appverif.chm 657331 512 6
appverif.exe 173520 6.2.9200.16384 1033 512 9
appverif.exe 216816 6.2.9200.16384 1033 512 17
cuzzapi.dll 23072 6.2.9200.16384 1033 512 34
cuzzapi.dll 21448 6.2.9200.16384 1033 512 22
cat2d609858545493b503b24bd3328d8d2a.cat 8157 512 5
cat4c0b3f635c0903217a3535759b7ce85f.cat 7792 512 10
catb1033a9482d5307d3df8fcd97174719e.cat 9783 512 19
vfprintpthelper.dll 367392 6.2.9200.16384 1033 512 26
cat9070517e54c750dca5f4eaa025eb8057.cat 8136 512 14
vfntlmless.dll 40136 6.2.9200.16384 1033 512 27
vfntlmless.dll 45336 6.2.9200.16384 1033 512 37
vfbasics.dll 406848 6.2.9200.16384 1033 512 16
vfbasics.dll 353328 6.2.9200.16384 1033 512 8
vfcompat.dll 90480 6.2.9200.16384 1033 512 38
vfcompat.dll 87328 6.2.9200.16384 1033 512 21
vfcuzz.dll 48976 6.2.9200.16384 1033 512 30
vfcuzz.dll 52032 6.2.9200.16384 1033 512 23
vfnet.dll 105056 6.2.9200.16384 1033 512 33
vfnet.dll 81592 6.2.9200.16384 1033 512 20
vfnws.dll 83248 6.2.9200.16384 1033 512 31
vfnws.dll 61384 6.2.9200.16384 1033 512 24
vfprint.dll 433376 6.2.9200.16384 1033 512 32
vfprint.dll 306592 6.2.9200.16384 1033 512 28
vrfauto.dll 211064 6.2.9200.16384 1033 512 2
vrfauto.dll 167392 6.2.9200.16384 1033 512 12
vrfauto.h 112394 512 4
vrfauto.h 112394 512 13
vrfauto.idl 31344 512 3
vrfauto.idl 31344 512 11
vrfcore.dll 183568 6.2.9200.16384 1033 512 18
vrfcore.dll 164200 6.2.9200.16384 1033 512 7
cat0f5c9874ec8b03b3a2ef2148f76b34cf.cat 7792 512 1
vfbasics.pdb is installed as part of Application Verifier and uses private symbols, this is why the public MS symbol store server does not have this pdb.
It looks like from our comments that there has been some error in the installation, you can reinstall Application Verifier from here, I just installed the 64 bit version and it appeared in
c:\windows\system32
Another thing to note from the book Inside Windows Debugging is that you must put c:\windows\system32 before the MS public symbol server path.