Re:Re: memory lead while using Glib regexp
- From: "Xi Yang" <jiandingzhe 163 com>
- To: "Nicola Fontana" <ntd entidi it>
- Cc: "gtk-app-devel-list gnome org" <gtk-app-devel-list gnome org>
- Subject: Re:Re: memory lead while using Glib regexp
- Date: Fri, 25 May 2012 10:43:30 +0800 (CST)
That is the problem. I free once but sometimes the regex is runned twice.
Thanks for a lot!
At 2012-03-07 02:46:21,"Nicola Fontana" <ntd entidi it> wrote:
Il giorno Fri, 2 Mar 2012 11:00:46 +0800 (CST)
"Xi Yang" <jiandingzhe 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]