Re: [Tracker] Performance improvement for tracker-0.6



On Thu, 2009-05-14 at 18:48 +0200, Carlos Garnacho wrote:

Here's an updated version, basically it moves table data handling to
libtracker-data (by introducing a TrackerDataUpdateMetadataContext
object), and adds support for initial insertions into the DB, instead of
doing 1 insertion and N updates.

I was just reviewing 169fcacef91396ebe77e50a82241d5742ce53d39, and then
I saw this:

+ tracker_db_interface_execute_query (iface, &error, sql, NULL);
+
+ if (error) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ }
+} <- end of function

Either the variable "sql" is const, but that isn't the case, or it's
leaked. Right? Looking at it it's leaked in both cases. In case of
INSERT it's leaked as a g_strdup_printf, in case of UPDATE it's leaked
because the parameter FALSE is passed to g_string_free.

And given that an awful lot of queries are executed by this function,
this is a leak that will grow to quite big proportions (the size of all
the stored data multiplied by length of the "UPDATE bla bla" pieces of
the string).

I suggest we add a g_free (sql) before a release is made with this ;)

Feel free to also rewrite attached patch and apply.

-- 
Philip Van Hoof, freelance software developer
home: me at pvanhoof dot be 
gnome: pvanhoof at gnome dot org 
http://pvanhoof.be/blog
http://codeminded.be

Attachment: leakfix.diff
Description: Text Data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]