Actually enable the global transaction string pool
authorPanu Matilainen <pmatilai@redhat.com>
Wed, 12 Sep 2012 10:43:46 +0000 (13:43 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Wed, 12 Sep 2012 11:03:36 +0000 (14:03 +0300)
- With this, practically all transaction member file (base- and dirname)
  and dependency strings get now stored in a giant transaction global
  string pool. Greenpeace applaudes us for all the rain-forests that
  will be saved by the memory savings... not. Some memory is saved
  but the real wins only start when everything is converted to use
  pool id's instead of string pointers. Also we're still creating
  a ridiculous number of private pools from various sources, but
  we gotta start someplace.

lib/depends.c

index e852344..20768bd 100644 (file)
@@ -101,6 +101,10 @@ static int removePackage(rpmts ts, Header h, rpmte depends)
         return 0;
     }
 
+    /* Ensure our pool exists before adding elements */
+    if (tsmem->pool == NULL)
+       tsmem->pool = rpmstrPoolCreate();
+
     /* Ensure pool is writable */
     if (tsmem->addedPackages != NULL)
        rpmstrPoolUnfreeze(tsmem->pool);
@@ -363,6 +367,10 @@ int rpmtsAddInstallElement(rpmts ts, Header h,
            goto exit;
     }
 
+    /* Ensure our pool exists before adding elements */
+    if (tsmem->pool == NULL)
+       tsmem->pool = rpmstrPoolCreate();
+
     /* Ensure pool is writable */
     if (tsmem->addedPackages != NULL)
        rpmstrPoolUnfreeze(tsmem->pool);