[PATCH 1/8] use slices for HalProperty

Rob Taylor rob.taylor at codethink.co.uk
Thu Mar 6 15:41:51 PST 2008


Use g_slice for storing HalProperty. Reduces memory fragmentation during
coldplug.
---
  hald/device.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hald/device.c b/hald/device.c
index 304f177..a0b99ac 100644
--- a/hald/device.c
+++ b/hald/device.c
@@ -80,14 +80,14 @@ hal_property_free (HalProperty *prop)
  		}
  		g_slist_free (prop->v.strlist_value);
  	}
-	g_free (prop);
+	g_slice_free (HalProperty, prop);
  }

  static inline HalProperty *
  hal_property_new (int type)
  {
  	HalProperty *prop;
-	prop = g_new0 (HalProperty, 1);
+	prop = g_slice_new0 (HalProperty);
  	prop->type = type;
  	return prop;
  }


More information about the hal mailing list