Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* SIGSEGV INSIDE malloc: HELP!!!
@ 1999-03-31  5:00 Phil LoCascio
  1999-04-02  5:00 ` Craig Neth
  1999-04-12  4:00 ` Aurel Balmosan
  0 siblings, 2 replies; 4+ messages in thread
From: Phil LoCascio @ 1999-03-31  5:00 UTC (permalink / raw)


    Hi,

using    OSF1 machine.name V4.0 878 alpha , I keep getting segmentation
faults INSIDE the systems malloc!!

Anyone seen this or know a solution?



    Cheers

    PHiL




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: SIGSEGV INSIDE malloc: HELP!!!
  1999-03-31  5:00 SIGSEGV INSIDE malloc: HELP!!! Phil LoCascio
@ 1999-04-02  5:00 ` Craig Neth
  1999-04-05  4:00   ` Phil LoCascio
  1999-04-12  4:00 ` Aurel Balmosan
  1 sibling, 1 reply; 4+ messages in thread
From: Craig Neth @ 1999-04-02  5:00 UTC (permalink / raw)
  To: locasciop

Phil LoCascio wrote:
> 
>     Hi,
> 
> using    OSF1 machine.name V4.0 878 alpha , I keep getting segmentation
> faults INSIDE the systems malloc!!
> 
> Anyone seen this or know a solution?
> 

Well, it _might_ mean there is a bug in malloc, but it's unlikely.

Much more likely is that your application has corrupted the heap. 
Malloc
has control structures in the heap that it uses to keep track of your
allocations; if you write off the 'end' of a block of memory that has
been allocated to you then these structures will be trashed.  

You might find the 'third degree' tool useful - it helps find 
places in your application where you are 'scribbling' on memory
that doesn't belong to you.  Do a 'man third' to learn more about
this tool.

-- 
----------------------------------------------------------------------------
Craig Neth                         ! craig.neth@compaq.com
Compaq Computer Corporation        ! 
110 Spit Brook Road ZKO3-2/W17     !
Nashua, NH 03062                   ! Opinions expressed herein are my
own.
============================================================================



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: SIGSEGV INSIDE malloc: HELP!!!
  1999-04-02  5:00 ` Craig Neth
@ 1999-04-05  4:00   ` Phil LoCascio
  0 siblings, 0 replies; 4+ messages in thread
From: Phil LoCascio @ 1999-04-05  4:00 UTC (permalink / raw)


Craig Neth wrote:

> Phil LoCascio wrote:
> >
> >     Hi,
> >
> > using    OSF1 machine.name V4.0 878 alpha , I keep getting segmentation
> > faults INSIDE the systems malloc!!
> >
> > Anyone seen this or know a solution?
> >
>
> Well, it _might_ mean there is a bug in malloc, but it's unlikely.
>
> Much more likely is that your application has corrupted the heap.
> Malloc
> has control structures in the heap that it uses to keep track of your
> allocations; if you write off the 'end' of a block of memory that has
> been allocated to you then these structures will be trashed.
>
> You might find the 'third degree' tool useful - it helps find
> places in your application where you are 'scribbling' on memory
> that doesn't belong to you.  Do a 'man third' to learn more about
> this tool.
>
> --
> ----------------------------------------------------------------------------
> Craig Neth                         ! craig.neth@compaq.com
> Compaq Computer Corporation        !
> 110 Spit Brook Road ZKO3-2/W17     !
> Nashua, NH 03062                   ! Opinions expressed herein are my
> own.
> ============================================================================

    Hi,

Working on a hunch I used my malloc "wrappers" to catch strdup, and I have
discovered that forcing allocations to be >=32bytes seems to prevent SIGSEGV.
This might be a malloc bug, or a strdup one. Since I received identical errors
using ElectricFence, I am assuming that it might have been a strdup one
combined with some other. For now everyting seems to work ok;

    Thank You!!


    Cheers

    PHiL




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: SIGSEGV INSIDE malloc: HELP!!!
  1999-03-31  5:00 SIGSEGV INSIDE malloc: HELP!!! Phil LoCascio
  1999-04-02  5:00 ` Craig Neth
@ 1999-04-12  4:00 ` Aurel Balmosan
  1 sibling, 0 replies; 4+ messages in thread
From: Aurel Balmosan @ 1999-04-12  4:00 UTC (permalink / raw)




Phil LoCascio wrote:

>     Hi,
>
> using    OSF1 machine.name V4.0 878 alpha , I keep getting segmentation
> faults INSIDE the systems malloc!!
>
> Anyone seen this or know a solution?
>
>     Cheers
>
>     PHiL

Well, thats the normal behaviour if you use more memory then you allocated
using malloc/calloc/realloc.

I.e. you allocated 10 bytes for a string with strlen(string)==10. If you
then do a strcpy(malloced_area, string) it will need 11 bytes!!! 10 bytes
for the string and 1 byte for the final 0-char.

This is the easiest example. In any case the program might or might not
crash depending on how often it uses malloc/calloc/realloc and free.

What you will see is that you get SIGSEGV/SIGBUS in routines like __free
or malloc...

Happy bug hunting,

    Aurel Balmosan.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1999-04-12  4:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-03-31  5:00 SIGSEGV INSIDE malloc: HELP!!! Phil LoCascio
1999-04-02  5:00 ` Craig Neth
1999-04-05  4:00   ` Phil LoCascio
1999-04-12  4:00 ` Aurel Balmosan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox