
yamp (yet another malloc problem)
|> |> I have the following code fragment
|> |>
|> |> 52 printf("diag0\n");
|> |> 53 if((ptr2=(float *)malloc(nobj*sizeof(float)))==NULL)
|> |> 54 error("FMEAN: MALLOC\n");
|> |> 55 printf("diag1\n");
|> |>
|> [snipped some]
|> |> and furthermore I have checked and nobj is a (relatively) small
|> |> integer (54). Yet, from the diagnostic prints, I know I'm getting
|> |> a core dump from the malloc statement! No error, just a core dump.
|>
|> It's hidden away in a place where you won't find so quickly, but the good
|> old faq does have an answer on this one:
|>
|> faq> 17.22: What do "Segmentation violation" and "Bus error" mean?
[munched]
|>
|> IMHO it would be a good thing to include a pointer to this Answer in the
|> section on library functions, something like "12.XX Is my malloc() broken?
|> It gives me a core dump! A: See question 17.22"
Sorry, I overlooked question 17.23 which deals with exactly this...
--
^^
University of Twente =x= \ tel. +31 53 893747
Tele-Informatics & Open Systems | \ tfx. +31 53 333815
P.O. Box 217 7500 AE Enschede /|__ \
The Netherlands (____)_/
``Look up the words in a dictionary. -- Ian Stewart - Does God Play Dice?
Mega: big (Referring to the use of high-performance
Flop: failure'' computers for weather prediction.)