crash only in release at first NewtonUpdate

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

crash only in release at first NewtonUpdate

Postby syl » Sun Sep 04, 2011 8:51 pm

Hello,

i'm currently in the process of experimenting newton with batterytech http://www.batterypoweredgames.com/batterytech
It's an abstraction framework for win32,ios,android,macosx, and currently i've tested newton only on a win32 project. It abstracts file paths, some os api, and GL functions to address a subset of GLES in order to code a game for iphone/android and at the same time for Desktop. It uses mingw, but i feel like it does not follow _MINGW_32_VER (i dont know why)

I had, without too much pain (look at wiki, i had to patch core\dgThreads.cpp and generally simd), been able to include Newton in my gamecode.

Here's my problem (and the workaround i found, it's self-explanatory)

Code: Select all
      // without this test, i had a crash (only in release...), after having to move the creation of the newtonWorld elsewhere than with my first test
      if ( context->tickDelta > 1 ) {
         //TODO test Newton
         // here we tick the simulation
         NewtonUpdate(world->newtonWorld, context->tickDelta);
      }



So, what could happen, knowing that it DOES NOT happen in DEBUG mode ?? Threading or memory locking problem ? and yeah, it's 1, with 0 it's still crashing


OK, you may have a problem to help me with so less informations, so here's a bit more : wiki part i contributed http://newtondynamics.com/wiki/index.ph ... 0_Tutorial


Concerning Newton, it works great (currently i have both bullet and newton, showing balls falling at the same speed from the same origin, so that's the only problem)

Ok, if you have a suggestion also concerning my integration of newton, dont hesitate :-)
Last edited by syl on Mon Sep 05, 2011 6:52 pm, edited 4 times in total.
syl
 
Posts: 7
Joined: Sat Sep 03, 2011 9:45 am

Re: crash only in release at first NewtonUpdate

Postby Julio Jerez » Mon Sep 05, 2011 3:44 pm

I would try to run on a single thread and and without simd first see if the problem goes away.
then after that enblle simd, my guess ther is some unligned instruction some where.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: crash only in release at first NewtonUpdate

Postby syl » Mon Sep 05, 2011 4:05 pm

i'm loading with that init :
Code: Select all
   context->world->newtonWorld = NewtonCreate();
   NewtonSetThreadsCount(context->world->newtonWorld, 1);
   NewtonInvalidateCache(context->world->newtonWorld);


this should run only one thread, or do it needs something else ?

Also, i've setup _SCALAR_ARITHMETIC_ONLY in defined symbols for preprocessor, is this OK to disable SIMD ?

it seems that the problem is solved if I boot early.
syl
 
Posts: 7
Joined: Sat Sep 03, 2011 9:45 am

Re: crash only in release at first NewtonUpdate

Postby Julio Jerez » Mon Sep 05, 2011 5:02 pm

syl wrote:it seems that the problem is solved if I boot early.

what is boot early?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: crash only in release at first NewtonUpdate

Postby syl » Mon Sep 05, 2011 5:19 pm

I meant that by initializing newton (calling NewtonCreate) earlier, the problem disappears

please excuse my English
syl
 
Posts: 7
Joined: Sat Sep 03, 2011 9:45 am

Re: crash only in release at first NewtonUpdate

Postby JernejL » Mon Sep 05, 2011 5:40 pm

newtoncreate should be the first thing you do before using any other newton functions.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: crash only in release at first NewtonUpdate

Postby syl » Mon Sep 05, 2011 6:49 pm

Yes, i know. In any case, i was calling it first. The crash appears if i do not wait a bit before using newton.
syl
 
Posts: 7
Joined: Sat Sep 03, 2011 9:45 am

Re: crash only in release at first NewtonUpdate

Postby Julio Jerez » Tue Sep 06, 2011 1:22 am

how did you get the pointer to the newton world if you did no call NewtonCreate?

you musted be passing a wrong word pointer.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
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 1 guest

cron