Bus error core dump??

Bus error core dump??

Post by Frank Y. X » Fri, 14 Aug 1998 04:00:00



Hi,

I have a program doing the following, and I have
a shell script to run it in a loop of about 300 iterations.
I will get about 1 or two of "Bus error core dump" err(s), which
occurs around the free() function calls.

Anybody please give me some hint of why?

Thanks a lot.

Frank

-----psudo code start:

char *array[51];
FILE *f_out;
...
f_out = fpen(filename, "a");
for(i = 0; i < 50 ; i++)
{
        array[i] = (char *)malloc(1024);
        if(!array[i])
           ...

Quote:}

array[50] = 0;

connec_oracle();
select (list) into array from (table_joins);
process(array);
write(f_out, array);

for(i = 0; i < 50 ; i++)
{
        free(array[i]);

Quote:}

close(f_out);
 
 
 

Bus error core dump??

Post by Fletcher Gle » Fri, 14 Aug 1998 04:00:00


A crash in free() is 99.999% probably the result of damage to the heap.
I'll bet that your program oversteps the boundary of one of your
allocated char arrays in array[].

--
                Fletcher Glenn


Quote:>Hi,

>I have a program doing the following, and I have
>a shell script to run it in a loop of about 300 iterations.
>I will get about 1 or two of "Bus error core dump" err(s), which
>occurs around the free() function calls.

>Anybody please give me some hint of why?

>Thanks a lot.

>Frank

>-----psudo code start:

>char *array[51];
>FILE *f_out;
>....
>f_out = fpen(filename, "a");
>for(i = 0; i < 50 ; i++)
>{
>    array[i] = (char *)malloc(1024);
>    if(!array[i])
>       ...
>}
>array[50] = 0;

>connec_oracle();
>select (list) into array from (table_joins);
>process(array);
>write(f_out, array);

>for(i = 0; i < 50 ; i++)
>{
>    free(array[i]);
>}

>close(f_out);


 
 
 

1. NCSA htppd 1.5 gives Bus Error (core dumped) !!

I've tried the newest NCSA httpd on my Sparc
(httpd_1.5a-export_solaris2.4_sparc.tar.Z)
and running the binary supplied with the package always results in this:

# uname -a
SunOS palmetto 5.5 Generic sun4m sparc SUNW,SPARCstation-10
# ./httpd
Bus Error (core dumped)
#

I know that the supplied binary is intended for Solaris 2.4 so I
recompiled it but I still get the same results with the resulting output
binary.

This seems to be the case with Solaris x86 2.5 as well.

What simple, obvious, no brainer thing have I over looked?!?!?!?

--
------------------------------------------------------------------------
 Kevin Martinez                 |           Fry's Electronics: Where

------------------------------------------------------------------------

2. named pipes

3. Bus error (core dumped) !please help!

4. HELP: Sendmail configuration in Solaris 2.4 (sparc)

5. Bus error - core dump

6. Help: setting up 2 RH7.2 linux boxes to ppp demand dial each other

7. java in netscape = bus error core dump

8. Warning on Sun/C++

9. (Bus Error) Core Dumped?

10. bus error core dump

11. FreeBSD problem: Bus Error (core dumped) !Please Help!

12. Bus error (core dump) in Solaris 2.5.1

13. Bus error (core dumped)