Il giorno Fri, 2 Mar 2012 11:00:46 +0800 (CST)
"Xi Yang" <jianding...@163.com> ha scritto:

> Hi, everyone!
> 
> 
> I use Glib's regular expression in a cycle, and find a rapid memory 
> consumption increase. Did I forget to release anything?
> 
> 
> Thanks a lot!

A working example would be better. Anyway, citing the g_regex_match()
doc:

"Note that if match_info is not NULL then it is created even if the
function returns FALSE, i.e. you must free it regardless if regular
expression actually matched."

> ...
>         // match and fetch something
>         if ( g_regex_match(regex_illumina, seq.header.c_str(), 
> GRegexMatchFlags(0), &what) ) {
>             tile_str = g_match_info_fetch(what,3);
>         }
>         else if ( g_regex_match(regex_casava_1p8, seq.header.c_str(), 
> GRegexMatchFlags(0), &what) ) {
>             tile_str = g_match_info_fetch(what,5);
>         }
> ...

If your first g_regex_match() fails you have a sharp leak.

Ciao.
-- 
Nicola

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to