On 2/10/07, Mounir Bakkali <mounir.bakkali@xxxxxxxxx> wrote:
Hi everything, Here is the issue: I am trying to allocate some memory for my data structure and after a msecs, I get a "segmentation fault" right after "allocating mem".... but if I change the size of the malloc from 256 to 512, it works just fine. My guess is that somehow, internal there is a segmentation fault but not in that peace of code but in another peace of code and that I get a segmentation fault only when I call malloc only when I try to allocate the memory.... I have checked the memory and it looks fine (lots of mem still available at execution time and right before the segmentation fault); Please, can you confirm? Do you know why is it that doing so?? Is there a way to prevent such behaviour? My kernel version is: 2.6.19.2 CPU: Pentium M (mobile centrino). RAM: 1GB Compiler: gcc 4.1.2-2 And here is the peace of code: // the following code is called about 2500 times. printf("allocating mem\n"); my = (char*) malloc(256); printf("GOOD!\n");
What does this have to do with the kernel? Thanks, Nish -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/