I've been programming in c for a little bit over a year, but never really used global variables a lot. However today I was trying to improve my SIMD game by writing a fast(ish) memset, and happened to have huge global buffers. Which resulted in a page fault.
Now to the question:
1 2 3 4 5 6 | int buffer[10000]; int main() { //stupid slow memset body for illustration for(int i = 0; i<10000;i++)buffer[i]=0; } |
Apparently causes a page fault. Is the buffer only reserved, not commited?.
Also the default memset seams to have no problem with this. Does it have __try, __catch to handle the page fault or is it solved in a better way?
As a side note: I can't seam to make a implementation with _mm_stream_si128 faster than _mm_storeu_si128 even for large memsets any pointers?