Unix Programming - seg fault

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > January 2005 > seg fault





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author seg fault
vasu1894@yahoo.com

2005-01-17, 2:47 am

hi;

iam developing gui with GTK.

iam crearting status bar, for this i allocated some memory using
g_malloc,

where is this g_malloc is located,(i just included gtk/gtk.h)

when iam linking statusbar with gtk lib files iam getting segmentation
fault.

how to clear this segmentation fault.


thank u;

srinivas.

joe durusau

2005-01-17, 5:56 pm



vasu1894@yahoo.com wrote:

> hi;
>
> iam developing gui with GTK.
>
> iam crearting status bar, for this i allocated some memory using
> g_malloc,
>
> where is this g_malloc is located,(i just included gtk/gtk.h)
>
> when iam linking statusbar with gtk lib files iam getting segmentation
> fault.
>
> how to clear this segmentation fault.
>
> thank u;
>
> srinivas.


Your question is not terribly clear. Are you getting a segfault when
literally linking, that is running something like
ld <something or other>
or are you getting a segfault at run time?

If at run time, you probably have a bad index somewhere.

Look up the map option in your linker's docs, or perhaps run ldd
against the executable if you need to know where g_malloc is
located, or perhaps you might read the man page on g_malloc.

Speaking only for myself,

Joe Durusau


Fletcher Glenn

2005-01-17, 5:56 pm

vasu1894@yahoo.com wrote:
> hi;
>
> iam developing gui with GTK.
>
> iam crearting status bar, for this i allocated some memory using
> g_malloc,
>
> where is this g_malloc is located,(i just included gtk/gtk.h)
>
> when iam linking statusbar with gtk lib files iam getting segmentation
> fault.
>
> how to clear this segmentation fault.
>
>
> thank u;
>
> srinivas.
>

Most of the time when you get a segment violation in an allocator
like malloc, it is because you have trashed the heap. Some causes
include: writing past the end of an allocated block, or freeing the
same pointer twice.

--

Fletcher Glenn

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com