Wednesday, April 7, 2010

Access violation....

So in my last blog, I called a function without actually allocating memory to a pointer.

You must have found out that, surprisingly, it works. I will leave that exercise to you guys to figure out how that works ( don't think that i don't know, i have done that exercise).

But to add to it.... the moment you want to access any member "variable" in the function, it crashes.

It crashes with Access violation..... so what on earth is this access violation?...

Its the operating systems way of telling you that you are entering its territory.

On a 32-bit machine, a pointer can access 2 pow 32 locations ( why 32?) thats about 4 GB of memory space.... this is called the process address space....

But wait... not all is available for you.... Lower 2 GB is for you (0x00000000 through 0x7FFFFFFF).. upper 2GB is for the system (0x80000000 through 0xFFFFFFFF).

No comments:

Post a Comment