wyldsj
asked on
page fault when call free()
Hi,
I am using MSVC 5.0 and it is a Win32 console application. My program always got a page fault when it runs a while. After tracing the error, I finally find that it occurs when I call free(). However, this is very strange because this free() call is within a loop. It looks like this:
for(i=0;i<48;i++)
free(myPointer[i]); // error occurs when i=18
free(myPointer);
The error occured when i = 18! I have checked myPointer's dimension and I am sure memory was successfully allocated to it. I would like to know what is the probable cause for this problem, or is it a bug of VC?
Any help is appreciated.
wyldsj
I am using MSVC 5.0 and it is a Win32 console application. My program always got a page fault when it runs a while. After tracing the error, I finally find that it occurs when I call free(). However, this is very strange because this free() call is within a loop. It looks like this:
for(i=0;i<48;i++)
free(myPointer[i]); // error occurs when i=18
free(myPointer);
The error occured when i = 18! I have checked myPointer's dimension and I am sure memory was successfully allocated to it. I would like to know what is the probable cause for this problem, or is it a bug of VC?
Any help is appreciated.
wyldsj
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Can you provide more details of your current code ? Maybe there is something you could have missed.