[Yum-devel] [PATCH] Don't keep full headers in memory during transaction
Panu Matilainen
pmatilai at laiskiainen.org
Thu Feb 17 09:48:07 UTC 2011
The open/close file callbacks only need NEVRA information in the "key".
Copy the necessary bits into a regular dict and pass that instead
of the entire header, the callback wont even know the difference
as the header behaves like a dict.
Saves (tens of) megabytes of memory on large transactions.
---
yum/depsolve.py | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/yum/depsolve.py b/yum/depsolve.py
index 3aaba0e..997c66d 100644
--- a/yum/depsolve.py
+++ b/yum/depsolve.py
@@ -220,8 +220,12 @@ class Depsolve(object):
txmbr.ts_state = 'i'
txmbr.output_state = TS_INSTALL
+ # grab essential data for callback use in hdr-like form
+ minhdr = {}
+ for item in ['epoch', 'name', 'version', 'release', 'arch']:
+ minhdr[item] = hdr[item]
- self.ts.addInstall(hdr, (hdr, rpmfile), txmbr.ts_state)
+ self.ts.addInstall(hdr, (minhdr, rpmfile), txmbr.ts_state)
self.verbose_logger.log(logginglevels.DEBUG_1,
_('Adding Package %s in mode %s'), txmbr.po, txmbr.ts_state)
if self.dsCallback:
--
1.7.4
More information about the Yum-devel
mailing list