delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2016/03/14/09:44:39

X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f
X-Recipient: geda-user AT delorie DOT com
Date: Mon, 14 Mar 2016 14:48:44 +0100 (CET)
X-X-Sender: igor2 AT igor2priv
To: geda-user AT delorie DOT com
X-Debug: to=geda-user AT delorie DOT com from="gedau AT igor2 DOT repo DOT hu"
From: gedau AT igor2 DOT repo DOT hu
Subject: Re: [geda-user] pcb: more memory leaks (Bonus track: a short story
on valgrinding the parser)
In-Reply-To: <alpine.DEB.2.00.1603130700180.7885@igor2priv>
Message-ID: <alpine.DEB.2.00.1603141421160.7885@igor2priv>
References: <alpine DOT DEB DOT 2 DOT 00 DOT 1603130700180 DOT 7885 AT igor2priv>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
MIME-Version: 1.0
Reply-To: geda-user AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: geda-user AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

1. Easy

- parse_y.y: rule pcbgroups: layer_group_string = $3; it's a dynamic 
allocated string in the lex that's stored in a global variable for later 
use. The variable then is never free'd. The reason is probably that 
another place layer_group_string gets assigned with a setting that should 
not be free'd. My solution was to strdup() the setting too, and always 
free the string after use. It's not super-efficient, but at least doesn't 
leak anymore. (r1286 - please ignore changes in the generated files)

- there's still a leak by flex; it keeps a buffer allocated, but I don't 
see any trivial way to free it.

As a bonus I figured how to trace back such leaks - a raw valgrind log for 
such a flex/bison string allocation is not very informative. For details, 
please refer to my devlog entry at

http://repo.hu/projects/pcb-rnd/devlog/20160314_valgrind_flex.html

Regards,

Igor2


P.S. with the batch hid, for the simple load-and-exit test there are only 
4 leaks left in pcb-rnd (77 bytes total). Two of these are pcb-rnd 
specific and will be easy to fix. The other two are dlopen() and flex 
leaks which I probably won't be able to fix. Next tests will be with some 
user actions added.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019