Strange null pointer exception

No, the problem is that the pointer returned is an error code. It failed to create the object requested, for example a window or open a file, and to tell you that it returns 0xFFFFFFFF. It is not a matter of having enough RAM.