   Memory crash.
  C++ In Visual Studio 2003 (.Net) with DirectX9 (December SDK Release) - Unmanaged.I'm having an odd problem here. In my object-based program, I seem to be having many memory-based errors, crashes, and freezes with the error message:Quote:Unhandled exception at 0x4fe12059 in NSRM.exe: 0xC0000005: Access violation writing location 0x00000000.And that error redirects me in the debugger to the line:Quote:if( FAILED( Dev->CreateVertexBuffer( sizeof( Verts ) , 0 , D3DFVF_D3DVertex , D3DPOOL_DEFAULT , GetVertBuffer( ) , NULL ) ) ){return false;}I don't understand how if the CreateVertexBuffer function were to fail, it wouldn't just trigger the FAILED macro, but instead, it crashes my program. Why does it do this? I can post more of my class if needed (as I believe the error is occouring because it is trying to write to GetVertBuffer( ) and cannot do so for some reason).All and any help is greatly appreciated!   
  The object you call the method on or one of the parameters you pass to the method is null (or contains a null pointer if it is a struct).  When the function tries to dereference it, it fails (since it points at 'memory location' 0)The most likely culprits are your Dev object and the return value of the GetVertexBuffer() function.   ;Quote:Original post by jfclavetteThe object you call the method on or one of the parameters you pass to the method is null (or contains a null pointer if it is a struct).  When the function tries to dereference it, it fails (since it points at 'memory location' 0)The most likely culprits are your Dev object and the return value of the GetVertexBuffer() function.You were right - running in Direct3D debug mode shows that the true error was:Quote:Direct3D9: (ERROR) :Invalid IDirect3DVertexBuffer9** pointer passed to CreateVertexBufferThis is odd, however, as it is obviously the GetVertexBuffer() that is causing the problem. But that function only returns the object's Vertex Buffer (see source below):Quote:LPDIRECT3DVERTEXBUFFER9* GameObject::GetVertBuffer(){return VB;}"VB" is a privately declared LPDIRECT3DVERTEXBUFFER9 object that I put at the top of the class definition. All this function does is return it.Quote:class GameObject{private: Vertex* Vertices;LPDIRECT3DVERTEXBUFFER9* VB;...}There shouldn't be any problems with obfuscuration because all of this takes place within the same class. The only other culprit I can think of is a pointer problem. Do you see any problems with the pointer notation I used in the program?   ;  You made VB a pointer. It has to be pointed at something, otherwise it isn't pointing at anything (and the returned pointer is null).Keep in mind that in release mode, the pointer may not be initialized at all, and much weirder things can happen as a result.   