segmentation fault in the shared library...

bridged with qdn.public.qnxrtp.porting
Post Reply
kc

segmentation fault in the shared library...

Post by kc » Mon Jun 09, 2003 4:05 pm

Hi all,

I keep getting a segmentation fault from my shared library. From the gdb
output, I see the following

#0 0xb0319c0b in _block_memalign () from /x86/lib/libc.so.2
#1 0xb0319c81 in _band_get_aligned () from /x86/lib/libc.so.2
#2 0xb0319d2f in _band_get () from /x86/lib/libc.so.2
#3 0xb031af92 in malloc () from /x86/lib/libc.so.2
......

I have a lot memory allocation and freeing in my shared library. Will that
be the cause of the problem? I really appreciate any help.

Thanks a lot
kc

Chris McKillop

Re: segmentation fault in the shared library...

Post by Chris McKillop » Mon Jun 09, 2003 7:05 pm

kc <kwlee@nortelnetworks.com> wrote:
Hi all,

I keep getting a segmentation fault from my shared library. From the gdb
output, I see the following

#0 0xb0319c0b in _block_memalign () from /x86/lib/libc.so.2
#1 0xb0319c81 in _band_get_aligned () from /x86/lib/libc.so.2
#2 0xb0319d2f in _band_get () from /x86/lib/libc.so.2
#3 0xb031af92 in malloc () from /x86/lib/libc.so.2
.....

I have a lot memory allocation and freeing in my shared library. Will that
be the cause of the problem? I really appreciate any help.
Normally this is due to improper memory allocation management in your code.
I assume you guys are using the IDE? If so, try launching remotly using the
Memory Analysis tool (last tab in the Launch Profile). This will generate
memory allocation events at runtime and will help you narrow down when and
where the first allocation mistake occurs in your code.

chris

--
Chris McKillop <cdm@qnx.com> "The faster I go, the behinder I get."
Software Engineer, QSSL -- Lewis Carroll --
http://qnx.wox.org/

kc

Re: segmentation fault in the shared library...

Post by kc » Tue Jun 10, 2003 1:55 pm

Hi Chris,

Thanks for your reply. I am not using any IDE. Is there any other way to
help me to track down the problem?

kc


"Chris McKillop" <cdm@qnx.com> wrote in message
news:bc2lqm$kle$4@nntp.qnx.com...
kc <kwlee@nortelnetworks.com> wrote:
Hi all,

I keep getting a segmentation fault from my shared library. From the gdb
output, I see the following

#0 0xb0319c0b in _block_memalign () from /x86/lib/libc.so.2
#1 0xb0319c81 in _band_get_aligned () from /x86/lib/libc.so.2
#2 0xb0319d2f in _band_get () from /x86/lib/libc.so.2
#3 0xb031af92 in malloc () from /x86/lib/libc.so.2
.....

I have a lot memory allocation and freeing in my shared library. Will
that
be the cause of the problem? I really appreciate any help.


Normally this is due to improper memory allocation management in your
code.
I assume you guys are using the IDE? If so, try launching remotly using
the
Memory Analysis tool (last tab in the Launch Profile). This will generate
memory allocation events at runtime and will help you narrow down when and
where the first allocation mistake occurs in your code.

chris

--
Chris McKillop <cdm@qnx.com> "The faster I go, the behinder I get."
Software Engineer, QSSL -- Lewis Carroll --
http://qnx.wox.org/

David Bacon

Re: segmentation fault in the shared library...

Post by David Bacon » Tue Jun 10, 2003 2:04 pm

Equivalently, link with /usr/lib/libmalloc_g.so (add -lmalloc_g
to your qcc command line).

dB

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
"kc" wrote ~ Tue, 10 Jun 2003 09:55:00 -0400:
Hi Chris,

Thanks for your reply. I am not using any IDE. Is there any other way to
help me to track down the problem?

kc


"Chris McKillop" <cdm@qnx.com> wrote in message
news:bc2lqm$kle$4@nntp.qnx.com...
kc <kwlee@nortelnetworks.com> wrote:
Hi all,

I keep getting a segmentation fault from my shared library. From the gdb
output, I see the following

#0 0xb0319c0b in _block_memalign () from /x86/lib/libc.so.2
#1 0xb0319c81 in _band_get_aligned () from /x86/lib/libc.so.2
#2 0xb0319d2f in _band_get () from /x86/lib/libc.so.2
#3 0xb031af92 in malloc () from /x86/lib/libc.so.2
.....

I have a lot memory allocation and freeing in my shared library. Will
that
be the cause of the problem? I really appreciate any help.


Normally this is due to improper memory allocation management in your
code.
I assume you guys are using the IDE? If so, try launching remotly using
the
Memory Analysis tool (last tab in the Launch Profile). This will generate
memory allocation events at runtime and will help you narrow down when and
where the first allocation mistake occurs in your code.

chris

--
Chris McKillop <cdm@qnx.com> "The faster I go, the behinder I get."
Software Engineer, QSSL -- Lewis Carroll --
http://qnx.wox.org/




David Bacon

Re: segmentation fault in the shared library...

Post by David Bacon » Tue Jun 10, 2003 2:38 pm

According to the chapter, "Heap Analysis - Making Memory Errors a
Thing of the Past" in the Help documentation, you also have to
include /usr/lib/malloc_g as the first entry of your LD_LIBRARY_PATH
environment variable before running your application, i.e.:

export LD_LIBRARY_PATH=/usr/lib/malloc_g:$LD_LIBRARY_PATH

dB

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
"kc" wrote ~ Tue, 10 Jun 2003 10:38:58 -0400:
Thanks dB.
Sorry about my ignorance. Now I get a bit more information from the gdb, but
how does it help me ?

#0 0xb89379e4 in _malloc_error () from /x86/usr/lib/libmalloc.so.2
#1 0xb8933a2b in checkBlock () from /x86/usr/lib/libmalloc.so.2
#2 0xb8933cf5 in _block_memalign () from /x86/usr/lib/libmalloc.so.2
#3 0xb8933d75 in _band_get_aligned () from /x86/usr/lib/libmalloc.so.2
#4 0xb8933e17 in _band_get () from /x86/usr/lib/libmalloc.so.2
#5 0xb8935c1f in _malloc_pc () from /x86/usr/lib/libmalloc.so.2
#6 0xb8935c8d in _malloc () from /x86/usr/lib/libmalloc.so.2
#7 0xb8936446 in _malloc_direct () from /x86/usr/lib/libmalloc.so.2
#8 0xb89364b0 in __malloc () from /x86/usr/lib/libmalloc.so.2
#9 0xb89364db in malloc () from /x86/usr/lib/libmalloc.so.2
......

kc

"David Bacon" <dbacon@qnx.com> wrote in message
news:1055254152831.dB@nntp.qnx.com...
Equivalently, link with /usr/lib/libmalloc_g.so (add -lmalloc_g
to your qcc command line).

dB

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
"kc" wrote ~ Tue, 10 Jun 2003 09:55:00 -0400:
Hi Chris,

Thanks for your reply. I am not using any IDE. Is there any other way to
help me to track down the problem?

kc


"Chris McKillop" <cdm@qnx.com> wrote in message
news:bc2lqm$kle$4@nntp.qnx.com...
kc <kwlee@nortelnetworks.com> wrote:
Hi all,

I keep getting a segmentation fault from my shared library. From the
gdb
output, I see the following

#0 0xb0319c0b in _block_memalign () from /x86/lib/libc.so.2
#1 0xb0319c81 in _band_get_aligned () from /x86/lib/libc.so.2
#2 0xb0319d2f in _band_get () from /x86/lib/libc.so.2
#3 0xb031af92 in malloc () from /x86/lib/libc.so.2
.....

I have a lot memory allocation and freeing in my shared library.
Will
that
be the cause of the problem? I really appreciate any help.


Normally this is due to improper memory allocation management in your
code.
I assume you guys are using the IDE? If so, try launching remotly
using
the
Memory Analysis tool (last tab in the Launch Profile). This will
generate
memory allocation events at runtime and will help you narrow down when
and
where the first allocation mistake occurs in your code.

chris

--
Chris McKillop <cdm@qnx.com> "The faster I go, the behinder I
get."
Software Engineer, QSSL -- Lewis Carroll --
http://qnx.wox.org/







kc

Re: segmentation fault in the shared library...

Post by kc » Tue Jun 10, 2003 2:38 pm

Thanks dB.
Sorry about my ignorance. Now I get a bit more information from the gdb, but
how does it help me ?

#0 0xb89379e4 in _malloc_error () from /x86/usr/lib/libmalloc.so.2
#1 0xb8933a2b in checkBlock () from /x86/usr/lib/libmalloc.so.2
#2 0xb8933cf5 in _block_memalign () from /x86/usr/lib/libmalloc.so.2
#3 0xb8933d75 in _band_get_aligned () from /x86/usr/lib/libmalloc.so.2
#4 0xb8933e17 in _band_get () from /x86/usr/lib/libmalloc.so.2
#5 0xb8935c1f in _malloc_pc () from /x86/usr/lib/libmalloc.so.2
#6 0xb8935c8d in _malloc () from /x86/usr/lib/libmalloc.so.2
#7 0xb8936446 in _malloc_direct () from /x86/usr/lib/libmalloc.so.2
#8 0xb89364b0 in __malloc () from /x86/usr/lib/libmalloc.so.2
#9 0xb89364db in malloc () from /x86/usr/lib/libmalloc.so.2
......

kc

"David Bacon" <dbacon@qnx.com> wrote in message
news:1055254152831.dB@nntp.qnx.com...
Equivalently, link with /usr/lib/libmalloc_g.so (add -lmalloc_g
to your qcc command line).

dB

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
"kc" wrote ~ Tue, 10 Jun 2003 09:55:00 -0400:
Hi Chris,

Thanks for your reply. I am not using any IDE. Is there any other way to
help me to track down the problem?

kc


"Chris McKillop" <cdm@qnx.com> wrote in message
news:bc2lqm$kle$4@nntp.qnx.com...
kc <kwlee@nortelnetworks.com> wrote:
Hi all,

I keep getting a segmentation fault from my shared library. From the
gdb
output, I see the following

#0 0xb0319c0b in _block_memalign () from /x86/lib/libc.so.2
#1 0xb0319c81 in _band_get_aligned () from /x86/lib/libc.so.2
#2 0xb0319d2f in _band_get () from /x86/lib/libc.so.2
#3 0xb031af92 in malloc () from /x86/lib/libc.so.2
.....

I have a lot memory allocation and freeing in my shared library.
Will
that
be the cause of the problem? I really appreciate any help.


Normally this is due to improper memory allocation management in your
code.
I assume you guys are using the IDE? If so, try launching remotly
using
the
Memory Analysis tool (last tab in the Launch Profile). This will
generate
memory allocation events at runtime and will help you narrow down when
and
where the first allocation mistake occurs in your code.

chris

--
Chris McKillop <cdm@qnx.com> "The faster I go, the behinder I
get."
Software Engineer, QSSL -- Lewis Carroll --
http://qnx.wox.org/




kc

Re: segmentation fault in the shared library...

Post by kc » Wed Jun 11, 2003 9:34 pm

Thanks


"David Bacon" <dbacon@qnx.com> wrote in message
news:1055256085873.dB@nntp.qnx.com...
According to the chapter, "Heap Analysis - Making Memory Errors a
Thing of the Past" in the Help documentation, you also have to
include /usr/lib/malloc_g as the first entry of your LD_LIBRARY_PATH
environment variable before running your application, i.e.:

export LD_LIBRARY_PATH=/usr/lib/malloc_g:$LD_LIBRARY_PATH

dB

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
"kc" wrote ~ Tue, 10 Jun 2003 10:38:58 -0400:
Thanks dB.
Sorry about my ignorance. Now I get a bit more information from the gdb,
but
how does it help me ?

#0 0xb89379e4 in _malloc_error () from /x86/usr/lib/libmalloc.so.2
#1 0xb8933a2b in checkBlock () from /x86/usr/lib/libmalloc.so.2
#2 0xb8933cf5 in _block_memalign () from /x86/usr/lib/libmalloc.so.2
#3 0xb8933d75 in _band_get_aligned () from /x86/usr/lib/libmalloc.so.2
#4 0xb8933e17 in _band_get () from /x86/usr/lib/libmalloc.so.2
#5 0xb8935c1f in _malloc_pc () from /x86/usr/lib/libmalloc.so.2
#6 0xb8935c8d in _malloc () from /x86/usr/lib/libmalloc.so.2
#7 0xb8936446 in _malloc_direct () from /x86/usr/lib/libmalloc.so.2
#8 0xb89364b0 in __malloc () from /x86/usr/lib/libmalloc.so.2
#9 0xb89364db in malloc () from /x86/usr/lib/libmalloc.so.2
......

kc

"David Bacon" <dbacon@qnx.com> wrote in message
news:1055254152831.dB@nntp.qnx.com...
Equivalently, link with /usr/lib/libmalloc_g.so (add -lmalloc_g
to your qcc command line).

dB

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
"kc" wrote ~ Tue, 10 Jun 2003 09:55:00 -0400:
Hi Chris,

Thanks for your reply. I am not using any IDE. Is there any other
way to
help me to track down the problem?

kc


"Chris McKillop" <cdm@qnx.com> wrote in message
news:bc2lqm$kle$4@nntp.qnx.com...
kc <kwlee@nortelnetworks.com> wrote:
Hi all,

I keep getting a segmentation fault from my shared library. From
the
gdb
output, I see the following

#0 0xb0319c0b in _block_memalign () from /x86/lib/libc.so.2
#1 0xb0319c81 in _band_get_aligned () from /x86/lib/libc.so.2
#2 0xb0319d2f in _band_get () from /x86/lib/libc.so.2
#3 0xb031af92 in malloc () from /x86/lib/libc.so.2
.....

I have a lot memory allocation and freeing in my shared library.
Will
that
be the cause of the problem? I really appreciate any help.


Normally this is due to improper memory allocation management in
your
code.
I assume you guys are using the IDE? If so, try launching remotly
using
the
Memory Analysis tool (last tab in the Launch Profile). This will
generate
memory allocation events at runtime and will help you narrow down
when
and
where the first allocation mistake occurs in your code.

chris

--
Chris McKillop <cdm@qnx.com> "The faster I go, the behinder
I
get."
Software Engineer, QSSL -- Lewis Carroll --
http://qnx.wox.org/







Post Reply

Return to “qdn.public.qnxrtp.porting”