Re: Memory woes
- From: "Gustavo J. A. M. " Carneiro <gjc inescporto pt>
- To: Rico <ras_kalb yahoo com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Memory woes
- Date: 25 Feb 2003 18:48:01 +0000
On Ter, 2003-02-25 at 17:36, Rico wrote:
Hello All!
I'm getting my hands dirrty with Pan. I have the following struct:
******************************************************************************
typedef struct _Group
{
GMutex * article_mutex;
guint loaded_since_last_fetch : 1;
guint articles_dirty : 1;
char permission;
gint8 flags;
gint8 old_sort_style;
gint8 new_sort_style;
gulong filter_show;
guint32 filter_bits;
gint32 article_qty;
gint32 article_read_qty;
gulong article_low;
gulong article_last_low_fetched;
gulong article_high;
gulong article_high_old;
Server * server;
char * name;
char * filter_name;
char * identity_name;
char * description; /* maybe null */
char * download_dir;
char * default_charset;
GStringChunk * chunk;
/* PRIVATE */
int _articles_refcount;
MemChunk * _article_chunk; /* Article objects */
Newsrc * _newsrc;
Newsrc * _purged;
GHashTable * _articles;
GPtrArray * _deleted_articles;
char * _one_big_chunk;
guint _no_fetch_on_load : 1;
}
Group;
*****************************************************************************
Something like: Group * g = group_new(server, name);
returns a properly initialized, complete Group, with all the above members
as reported by gdb. I add those Group's to a GPtrArray like so:
GPtrArray * groups = g_ptr_array_new ();
g_ptr_array_add (groups, g);
then call_some_func((Group **) groups->pdata);
but inside call_some_func(Group **groups), for all x, on
print *groups[x]
gdb does not see the last member, _no_fetch_on_load. However, the compiler does
not complain about an unknown member. Instead,
if (!groups[x]->_no_fetch_on_load) fetch_headers();
would _always_ make the call to fetch_headers(), even though I had set
_no_fetch_on_load to TRUE before getting to that point. Anyone has any idea,
could provide any hint about what's going on here? I've tried using a gboolean
instead of a guint _no_fetch_on_load, but same problem. Also, what does the
':1'
mean in "guint loaded_since_last_fetch : 1" ? Is it a compiler extension or is
it standard C ?
That is a bitfield. ':1' means that the structure field
loaded_since_last_fetch occupies only one bit in the structure. In this
case, you have a 1-bit unsigned integer, which obviously can only hold
the values 0 and 1.
Bitfields are standard C.
In my opinion, gdb is very buggy, unfortunately.
Thanks,
Rico.
__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
--
Gustavo João Alves Marques Carneiro
<gjc inescporto pt> <gustavo users sourceforge net>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]