5645an@gmuvax.gmu.edu (06/09/91)
I am having a problem with virtual memory allocation in a program. It seems to occur at memory intensive points during execution. The following line of code mallocs some memory (numPts = 3708, so 14,832 bytes):
line = (int*)malloc((numPts)*sizeof(int));
I get an error message from malloc -
failed on vm_allocate
but it still returns a value for the pointer (not NULL)
(gdb) p line
$4 = (port_name_array_t) 0x294c000
Then later, I try to access this memory space, and of course, I get a segmentation fault.
Program received signal 11, Segmentation fault
I have used the vm_statistics() function to print out available memory, and it appears I still have some.
Anyone have any suggestions
?