First chance exception [program] 0xc0000005 in debug mode

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

First chance exception [program] 0xc0000005 in debug mode

Postby Julio Jerez » Thu Jul 15, 2004 6:02 pm

I get the message “First chance exception [program] 0xc0000005” when I call the function NewtonCollisionTreeEnd?

This message is generated by Microsoft Visual Studio debugger when a program access and illegal memory address, normally this would be a crash error, except when the exception is generated by a virtual memory chunk.

The collision tree algorithm generates a wing edge structure to determine adjacency information between faces of the mesh. The memory required for this structure is function of the amount of connectivity in the mesh and it is virtually impossible to determine in advance. So what Newton does is that is used the virtual memory allocation function provided by the operating system.
It starts by allocating 256 megabyte of memory but only committing 16 megabytes.
This is usually enough for most medium size meshes, however large meshes can go beyond that limits and when and access violation happens an exception handler check if the offending address is with in the 256 virtual memory space, and commit another 16 megabytes. It keeps doing that until either it runs out space or the algorithm subsides.

The memory is allocated this way, because virtual memory is not allocated until is needed, so system low in memory resources will not slow down because the application in using 256 mb every time the application build a collision tree.
Julio Jerez
Posts: 11153
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 6 guests