From 03021713e5315312b150e6ac9c5cf48fe68f7615 Mon Sep 17 00:00:00 2001 From: Nagy Gabor Date: Tue, 15 Jul 2008 01:07:22 +0200 Subject: _alpm_db_add_pkgincache rework Commit 8240da6cb3ff95ad480efe3e1876104024398fae broke some alpm hierarchy and introduced a new memleak (trans->packages was never freed in case of add transaction, even if the transaction wasn't committed), so it is reverted now. We follow a different approach to reduce memory usage: _alpm_db_add_pkgincache doesn't duplicate the whole package before adding it to the cache, only the package name and version (INFRQ_BASE). This method needs very small extra memory (compared to the reverted method), and after transaction commit we use less memory than before (since the big 'files' fields are not copied to cache), this is useful in GUIs. Note: The old add_pkgincache was a bit broken, since pkg->origin wasn't filled in correctly. Signed-off-by: Nagy Gabor Acked-by: Xavier Chantry Signed-off-by: Dan McGee --- lib/libalpm/trans.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib/libalpm/trans.c') diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c index 06084ae9..d6b165d3 100644 --- a/lib/libalpm/trans.c +++ b/lib/libalpm/trans.c @@ -251,8 +251,7 @@ void _alpm_trans_free(pmtrans_t *trans) if(trans->type == PM_TRANS_TYPE_SYNC) { alpm_list_free_inner(trans->packages, (alpm_list_fn_free)_alpm_sync_free); - } else if (trans->type == PM_TRANS_TYPE_REMOVE || - trans->type == PM_TRANS_TYPE_REMOVEUPGRADE) { + } else { alpm_list_free_inner(trans->packages, (alpm_list_fn_free)_alpm_pkg_free); } alpm_list_free(trans->packages); -- cgit v1.2.3