public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Segmentation fault on malloc call
@ 1999-09-29 13:48 Nawin Somyat
  1999-09-30  1:26 ` Casper H.S. Dik - Network Security Engineer
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Nawin Somyat @ 1999-09-29 13:48 UTC (permalink / raw)
  To: help-gcc

I'm tring to test memory allocation on my system and get SIGSEGV with
the
following (extracted) code

.....
SYM_ENTRY* entry;

if ((entry = malloc(sizeof(SYM_ENTRY)) == NULL)
  return (NULL);
.....

where SYM_ENTRY is a pointer.

When I do a loop on this code, only after a few loops, the program gives
me
SIGSEGV. This fault is reproducible after the same number of loops.

I tried to debug on gdb and get to the point where it told me that the
SIGSEGV is
from  _malloc_unlocked ().

Can anyone give me where I should check out next?

My system is Solaris 2.5 on UltraSparc I using gcc version 2.7.2.3.
I also tried the same program on Solaris 2.5.1 with the same version of
gcc
and it gave me the same result. I use the malloc function that comes
with
Sun library.

Thank you

Nawin

If possible, could you reply to my email address "snawin@engr.tu.ac.th"

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

* Re: Segmentation fault on malloc call
  1999-09-29 13:48 Segmentation fault on malloc call Nawin Somyat
@ 1999-09-30  1:26 ` Casper H.S. Dik - Network Security Engineer
  1999-09-30 23:56   ` Casper H.S. Dik - Network Security Engineer
  1999-10-01  0:00   ` Casper H.S. Dik - Network Security Engineer
  1999-09-30  6:03 ` Kenneth C Stahl
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 12+ messages in thread
From: Casper H.S. Dik - Network Security Engineer @ 1999-09-30  1:26 UTC (permalink / raw)
  To: help-gcc

[[ PLEASE DON'T SEND ME EMAIL COPIES OF POSTINGS ]]

Nawin Somyat <snawin@engr.tu.ac.th> writes:

>I'm tring to test memory allocation on my system and get SIGSEGV with
>the
>following (extracted) code

>.....
>SYM_ENTRY* entry;

>if ((entry = malloc(sizeof(SYM_ENTRY)) == NULL)
>  return (NULL);
>.....

>where SYM_ENTRY is a pointer.

>When I do a loop on this code, only after a few loops, the program gives
>me
>SIGSEGV. This fault is reproducible after the same number of loops.


You're overstepping the boundaries of the malloc'ed memory.

(A crash in malloc typically indicates a memory use error in your
program)

Casper
--
Expressed in this posting are my opinions.  They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.

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

* Re: Segmentation fault on malloc call
  1999-09-29 13:48 Segmentation fault on malloc call Nawin Somyat
  1999-09-30  1:26 ` Casper H.S. Dik - Network Security Engineer
@ 1999-09-30  6:03 ` Kenneth C Stahl
  1999-09-30  6:12   ` Alan Stange
                     ` (2 more replies)
  1999-09-30 23:56 ` Nawin Somyat
  1999-10-01  0:00 ` Nawin Somyat
  3 siblings, 3 replies; 12+ messages in thread
From: Kenneth C Stahl @ 1999-09-30  6:03 UTC (permalink / raw)
  To: help-gcc

What is your ulimit?

Nawin Somyat wrote:
> 
> I'm tring to test memory allocation on my system and get SIGSEGV with
> the
> following (extracted) code
> 
> .....
> SYM_ENTRY* entry;
> 
> if ((entry = malloc(sizeof(SYM_ENTRY)) == NULL)
>   return (NULL);
> .....
> 
> where SYM_ENTRY is a pointer.
> 
> When I do a loop on this code, only after a few loops, the program gives
> me
> SIGSEGV. This fault is reproducible after the same number of loops.
> 
> I tried to debug on gdb and get to the point where it told me that the
> SIGSEGV is
> from  _malloc_unlocked ().
> 
> Can anyone give me where I should check out next?
> 
> My system is Solaris 2.5 on UltraSparc I using gcc version 2.7.2.3.
> I also tried the same program on Solaris 2.5.1 with the same version of
> gcc
> and it gave me the same result. I use the malloc function that comes
> with
> Sun library.
> 
> Thank you
> 
> Nawin
> 
> If possible, could you reply to my email address "snawin@engr.tu.ac.th"

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

* Re: Segmentation fault on malloc call
  1999-09-30  6:03 ` Kenneth C Stahl
@ 1999-09-30  6:12   ` Alan Stange
  1999-09-30 23:56     ` Alan Stange
  1999-10-01  0:00     ` Alan Stange
  1999-09-30 23:56   ` Kenneth C Stahl
  1999-10-01  0:00   ` Kenneth C Stahl
  2 siblings, 2 replies; 12+ messages in thread
From: Alan Stange @ 1999-09-30  6:12 UTC (permalink / raw)
  To: help-gcc

Hi,

The times that I've seen this usually involve stomping on the heap
itself.  For example, allocating 16 bytes, but then using 32, etc.
Using purify, you'll find this right away.

Also, try "man watchmalloc" to help chasing down the problem.

--
Alan L. Stange     Renaissance Technologies Corp.    stange@rentec.com



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

* Segmentation fault on malloc call
  1999-09-29 13:48 Segmentation fault on malloc call Nawin Somyat
  1999-09-30  1:26 ` Casper H.S. Dik - Network Security Engineer
  1999-09-30  6:03 ` Kenneth C Stahl
@ 1999-09-30 23:56 ` Nawin Somyat
  1999-10-01  0:00 ` Nawin Somyat
  3 siblings, 0 replies; 12+ messages in thread
From: Nawin Somyat @ 1999-09-30 23:56 UTC (permalink / raw)
  To: help-gcc

I'm tring to test memory allocation on my system and get SIGSEGV with
the
following (extracted) code

.....
SYM_ENTRY* entry;

if ((entry = malloc(sizeof(SYM_ENTRY)) == NULL)
  return (NULL);
.....

where SYM_ENTRY is a pointer.

When I do a loop on this code, only after a few loops, the program gives
me
SIGSEGV. This fault is reproducible after the same number of loops.

I tried to debug on gdb and get to the point where it told me that the
SIGSEGV is
from  _malloc_unlocked ().

Can anyone give me where I should check out next?

My system is Solaris 2.5 on UltraSparc I using gcc version 2.7.2.3.
I also tried the same program on Solaris 2.5.1 with the same version of
gcc
and it gave me the same result. I use the malloc function that comes
with
Sun library.

Thank you

Nawin

If possible, could you reply to my email address "snawin@engr.tu.ac.th"

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

* Re: Segmentation fault on malloc call
  1999-09-30  1:26 ` Casper H.S. Dik - Network Security Engineer
@ 1999-09-30 23:56   ` Casper H.S. Dik - Network Security Engineer
  1999-10-01  0:00   ` Casper H.S. Dik - Network Security Engineer
  1 sibling, 0 replies; 12+ messages in thread
From: Casper H.S. Dik - Network Security Engineer @ 1999-09-30 23:56 UTC (permalink / raw)
  To: help-gcc

[[ PLEASE DON'T SEND ME EMAIL COPIES OF POSTINGS ]]

Nawin Somyat <snawin@engr.tu.ac.th> writes:

>I'm tring to test memory allocation on my system and get SIGSEGV with
>the
>following (extracted) code

>.....
>SYM_ENTRY* entry;

>if ((entry = malloc(sizeof(SYM_ENTRY)) == NULL)
>  return (NULL);
>.....

>where SYM_ENTRY is a pointer.

>When I do a loop on this code, only after a few loops, the program gives
>me
>SIGSEGV. This fault is reproducible after the same number of loops.


You're overstepping the boundaries of the malloc'ed memory.

(A crash in malloc typically indicates a memory use error in your
program)

Casper
--
Expressed in this posting are my opinions.  They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.

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

* Re: Segmentation fault on malloc call
  1999-09-30  6:12   ` Alan Stange
@ 1999-09-30 23:56     ` Alan Stange
  1999-10-01  0:00     ` Alan Stange
  1 sibling, 0 replies; 12+ messages in thread
From: Alan Stange @ 1999-09-30 23:56 UTC (permalink / raw)
  To: help-gcc

Hi,

The times that I've seen this usually involve stomping on the heap
itself.  For example, allocating 16 bytes, but then using 32, etc.
Using purify, you'll find this right away.

Also, try "man watchmalloc" to help chasing down the problem.

--
Alan L. Stange     Renaissance Technologies Corp.    stange@rentec.com



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

* Re: Segmentation fault on malloc call
  1999-09-30  6:03 ` Kenneth C Stahl
  1999-09-30  6:12   ` Alan Stange
@ 1999-09-30 23:56   ` Kenneth C Stahl
  1999-10-01  0:00   ` Kenneth C Stahl
  2 siblings, 0 replies; 12+ messages in thread
From: Kenneth C Stahl @ 1999-09-30 23:56 UTC (permalink / raw)
  To: help-gcc

What is your ulimit?

Nawin Somyat wrote:
> 
> I'm tring to test memory allocation on my system and get SIGSEGV with
> the
> following (extracted) code
> 
> .....
> SYM_ENTRY* entry;
> 
> if ((entry = malloc(sizeof(SYM_ENTRY)) == NULL)
>   return (NULL);
> .....
> 
> where SYM_ENTRY is a pointer.
> 
> When I do a loop on this code, only after a few loops, the program gives
> me
> SIGSEGV. This fault is reproducible after the same number of loops.
> 
> I tried to debug on gdb and get to the point where it told me that the
> SIGSEGV is
> from  _malloc_unlocked ().
> 
> Can anyone give me where I should check out next?
> 
> My system is Solaris 2.5 on UltraSparc I using gcc version 2.7.2.3.
> I also tried the same program on Solaris 2.5.1 with the same version of
> gcc
> and it gave me the same result. I use the malloc function that comes
> with
> Sun library.
> 
> Thank you
> 
> Nawin
> 
> If possible, could you reply to my email address "snawin@engr.tu.ac.th"

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

* Re: Segmentation fault on malloc call
  1999-09-30  6:03 ` Kenneth C Stahl
  1999-09-30  6:12   ` Alan Stange
  1999-09-30 23:56   ` Kenneth C Stahl
@ 1999-10-01  0:00   ` Kenneth C Stahl
  2 siblings, 0 replies; 12+ messages in thread
From: Kenneth C Stahl @ 1999-10-01  0:00 UTC (permalink / raw)
  To: help-gcc

What is your ulimit?

Nawin Somyat wrote:
> 
> I'm tring to test memory allocation on my system and get SIGSEGV with
> the
> following (extracted) code
> 
> .....
> SYM_ENTRY* entry;
> 
> if ((entry = malloc(sizeof(SYM_ENTRY)) == NULL)
>   return (NULL);
> .....
> 
> where SYM_ENTRY is a pointer.
> 
> When I do a loop on this code, only after a few loops, the program gives
> me
> SIGSEGV. This fault is reproducible after the same number of loops.
> 
> I tried to debug on gdb and get to the point where it told me that the
> SIGSEGV is
> from  _malloc_unlocked ().
> 
> Can anyone give me where I should check out next?
> 
> My system is Solaris 2.5 on UltraSparc I using gcc version 2.7.2.3.
> I also tried the same program on Solaris 2.5.1 with the same version of
> gcc
> and it gave me the same result. I use the malloc function that comes
> with
> Sun library.
> 
> Thank you
> 
> Nawin
> 
> If possible, could you reply to my email address "snawin@engr.tu.ac.th"

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

* Re: Segmentation fault on malloc call
  1999-09-30  1:26 ` Casper H.S. Dik - Network Security Engineer
  1999-09-30 23:56   ` Casper H.S. Dik - Network Security Engineer
@ 1999-10-01  0:00   ` Casper H.S. Dik - Network Security Engineer
  1 sibling, 0 replies; 12+ messages in thread
From: Casper H.S. Dik - Network Security Engineer @ 1999-10-01  0:00 UTC (permalink / raw)
  To: help-gcc

[[ PLEASE DON'T SEND ME EMAIL COPIES OF POSTINGS ]]

Nawin Somyat <snawin@engr.tu.ac.th> writes:

>I'm tring to test memory allocation on my system and get SIGSEGV with
>the
>following (extracted) code

>.....
>SYM_ENTRY* entry;

>if ((entry = malloc(sizeof(SYM_ENTRY)) == NULL)
>  return (NULL);
>.....

>where SYM_ENTRY is a pointer.

>When I do a loop on this code, only after a few loops, the program gives
>me
>SIGSEGV. This fault is reproducible after the same number of loops.


You're overstepping the boundaries of the malloc'ed memory.

(A crash in malloc typically indicates a memory use error in your
program)

Casper
--
Expressed in this posting are my opinions.  They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.

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

* Segmentation fault on malloc call
  1999-09-29 13:48 Segmentation fault on malloc call Nawin Somyat
                   ` (2 preceding siblings ...)
  1999-09-30 23:56 ` Nawin Somyat
@ 1999-10-01  0:00 ` Nawin Somyat
  3 siblings, 0 replies; 12+ messages in thread
From: Nawin Somyat @ 1999-10-01  0:00 UTC (permalink / raw)
  To: help-gcc

I'm tring to test memory allocation on my system and get SIGSEGV with
the
following (extracted) code

.....
SYM_ENTRY* entry;

if ((entry = malloc(sizeof(SYM_ENTRY)) == NULL)
  return (NULL);
.....

where SYM_ENTRY is a pointer.

When I do a loop on this code, only after a few loops, the program gives
me
SIGSEGV. This fault is reproducible after the same number of loops.

I tried to debug on gdb and get to the point where it told me that the
SIGSEGV is
from  _malloc_unlocked ().

Can anyone give me where I should check out next?

My system is Solaris 2.5 on UltraSparc I using gcc version 2.7.2.3.
I also tried the same program on Solaris 2.5.1 with the same version of
gcc
and it gave me the same result. I use the malloc function that comes
with
Sun library.

Thank you

Nawin

If possible, could you reply to my email address "snawin@engr.tu.ac.th"

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

* Re: Segmentation fault on malloc call
  1999-09-30  6:12   ` Alan Stange
  1999-09-30 23:56     ` Alan Stange
@ 1999-10-01  0:00     ` Alan Stange
  1 sibling, 0 replies; 12+ messages in thread
From: Alan Stange @ 1999-10-01  0:00 UTC (permalink / raw)
  To: help-gcc

Hi,

The times that I've seen this usually involve stomping on the heap
itself.  For example, allocating 16 bytes, but then using 32, etc.
Using purify, you'll find this right away.

Also, try "man watchmalloc" to help chasing down the problem.

--
Alan L. Stange     Renaissance Technologies Corp.    stange@rentec.com



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

end of thread, other threads:[~1999-10-01  0:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-29 13:48 Segmentation fault on malloc call Nawin Somyat
1999-09-30  1:26 ` Casper H.S. Dik - Network Security Engineer
1999-09-30 23:56   ` Casper H.S. Dik - Network Security Engineer
1999-10-01  0:00   ` Casper H.S. Dik - Network Security Engineer
1999-09-30  6:03 ` Kenneth C Stahl
1999-09-30  6:12   ` Alan Stange
1999-09-30 23:56     ` Alan Stange
1999-10-01  0:00     ` Alan Stange
1999-09-30 23:56   ` Kenneth C Stahl
1999-10-01  0:00   ` Kenneth C Stahl
1999-09-30 23:56 ` Nawin Somyat
1999-10-01  0:00 ` Nawin Somyat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).