Re: Memory isn't freed for g_ptr_array after calling g_ptr_array_free(myAry, TRUE)

2010-03-07 Thread Brian Lavender
r_array_new_with_free_func(mydestroy); // Add lots of individuals to the array. for (i=0; i<2500;i++) { makeRandIndV1(myRand, &theInd); g_ptr_array_add(myAry, theInd); } // free the array. g_ptr_array_free(myAry, TRUE); } return 0; } On Sun, Mar 07, 201

Memory isn't freed for g_ptr_array after calling g_ptr_array_free(myAry, TRUE)

2010-03-07 Thread Brian Lavender
_ptr_array_free(myAry, TRUE); return 0; } -- Brian Lavender http://www.brie.com/brian/ "There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no ob

Re: g_atomic_pointer*

2010-03-02 Thread Brian Lavender
for the same resource. It is your typical dining philosopher problem. An atomic operation is used in place of a mutex (may actually use a mutex or a semaphore underneath), so that access to a resource is synchronized. I haven't quite figured out the resource that is being guarded here, but it look

Re: Array of arrays

2010-02-28 Thread Brian Lavender
pass arguments! void load_array( GArray *(*garray)[NUM_ARYS] ); I will check out the g_ptr_array! brian On Sat, Feb 27, 2010 at 06:50:34PM -0800, Brian Lavender wrote: > === simplearray2.c === > > > #include > > #define NUM_ARYS 5 > > void load_array( GArray *(*garray)

Re: Array of arrays

2010-02-28 Thread Brian Lavender
\n", j); for (i = 0; i < 10; i++) g_print ("index %d value %d\n", i, g_array_index (garrays[j], gint, i)); } for (j=0; j < NUM_ARYS; j++) g_array_free (garrays[j], TRUE); } On Sun, Feb 28, 2010 at 02:48:01PM -0800, Brian Lavender wrote: > On Sat, Feb 27,

Re: Array of arrays

2010-02-28 Thread Brian Lavender
On Sat, Feb 27, 2010 at 10:06:46PM -0500, Tristan Van Berkom wrote: > On Sat, Feb 27, 2010 at 9:50 PM, Brian Lavender wrote: > > I guess the list stripped the attachments. The code is included in this > > message. > > > > Hi, > First of all it would be help

Re: Array of arrays

2010-02-28 Thread Brian Lavender
Sorry, the second set of code is what I want to do, but if you run it, the arrays have all the same values, instead of the values actually inserted, not quite what I had wanted. On Sat, Feb 27, 2010 at 10:06:46PM -0500, Tristan Van Berkom wrote: > On Sat, Feb 27, 2010 at 9:50 PM, Brian Laven

Re: Array of arrays

2010-02-27 Thread Brian Lavender
I guess the list stripped the attachments. The code is included in this message. brian On Sat, Feb 27, 2010 at 06:47:30PM -0800, Brian Lavender wrote: > I was experimenting with creating an array of arrays. Maybe I shouldn't > be using GArray but something different such as pointer

Array of arrays

2010-02-27 Thread Brian Lavender
know if I have a problem with operator precedence or if the GArrays point to just one array. The two programs are the following. simplearray.c - loads just one array simplearray2.c - loads an array of arrays Any input is appreciated. brian -- Brian Lavender http://www.brie.com/brian/ "