Re: memory allocation in GLIB
- From: "Gustavo J. A. M. " Carneiro <gjc inescporto pt>
- To: Jim Parker <hopeye cfl rr com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: memory allocation in GLIB
- Date: 12 Mar 2003 11:38:45 +0000
On Seg, 2003-03-10 at 14:10, Jim Parker wrote:
G'Day !
I have a problem (SEGFAULT) when freeing a vector allocated using
routines in GLIB (version 1.2.10).
I declare my variable as:
gfloat *vector;
I then allocate memory as:
vector = g_malloc ( (some_int)*sizeof(gfloat) );
This allows me to access the memory using:
for (i=0; i<(some_int); i++) vector[i] = some_float;
then when exiting the function, I free the memory using:
g_free( vector );
This statement causes a SEGFAULT. Can anyone suggest what I am doing
wrong.
The code seems correct. Must be some other problem. Try running the
program under gdb, after compiling with -g, to see why it segfaults.
--
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]