From: Jo-Philipp Wich Date: Thu, 16 Feb 2017 15:44:07 +0000 (+0100) Subject: opkg-cl: stop preloading package feeds on install X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=863a21b5c6db1481fdd12a76d700543520288e49;p=oweals%2Fopkg-lede.git opkg-cl: stop preloading package feeds on install Instead of unconditionally loading all package feed lists entirely into memory, let opkg_install_cmd() selectively parse the lists using the new pkg_hash_load_package_details() helper. This will result in a slightly longer runtime but dramatically reduces the memory requirements. On an x86_64 test system, the peak heap memory consumption during an "opkg install luci" dropped from 3.7 MB to about 360 KB, a decrease of roughly 90%. Signed-off-by: Jo-Philipp Wich --- diff --git a/src/opkg-cl.c b/src/opkg-cl.c index e2f10a1..47e2056 100644 --- a/src/opkg-cl.c +++ b/src/opkg-cl.c @@ -387,7 +387,8 @@ int main(int argc, char *argv[]) cmd_name = argv[opts++]; - if (!strcmp(cmd_name, "print-architecture") || + if (!strcmp(cmd_name, "install") || + !strcmp(cmd_name, "print-architecture") || !strcmp(cmd_name, "print_architecture") || !strcmp(cmd_name, "print-installation-architecture") || !strcmp(cmd_name, "print_installation_architecture")) @@ -395,6 +396,7 @@ int main(int argc, char *argv[]) if (!strcmp(cmd_name, "flag") || !strcmp(cmd_name, "configure") || + !strcmp(cmd_name, "install") || !strcmp(cmd_name, "remove") || !strcmp(cmd_name, "files") || !strcmp(cmd_name, "search") ||