General

Reply

GC.Collect causes Node.StopAllActions to throw NullRefException?

[ Edited ]

I've been trying to double check that I'm properly freeing all memory with dispose and cleanup methods. While testing GC.Collect, I found that it would cause Node.StopAllActions to throw a NullRefException. The exception is only thrown when running with the debugger- Ctrl-F5 works fine.

 

The project below demonstrates the error that I'm seeing. Line 504 in AppManager.cs is where the problem occurs. Press the X key to hit the error.

 

http://dl.dropbox.com/u/9158350/PssGameFramework-2012-03-14-crashes.zip

pass: pssbetacrew

 

I think I'll try to import the gameengine src into my project to see if that will give me a better idea where the NullRef is coming from.

Please use plain text.

Re: GC.Collect causes Node.StopAllActions to throw NullRefException?

The problem looks to be a conflict between the Node finalizer and Director.Terminate that leaves ActionManager.Instance as null but still called.

Please use plain text.

Re: GC.Collect causes Node.StopAllActions to throw NullRefException?

Hi YstadTakuza,

Thanks for the report. I'll see if we can take a look at these problems in the coming few days.

Cheers
James
PlayStation®Mobile Dev Team
Please use plain text.

Re: GC.Collect causes Node.StopAllActions to throw NullRefException?

I've had a brief look into the problems, and I agree with you in that its down to the finalizer and the Director.Terminate() methods. The Director.Terminate() method is responsible for making the ActionManager null, so when the GC comes round and calls the desctructors, the links to the actions are no longer there, which appears to be causing the NullReferenceException to be thrown. 

PlayStation®Mobile Dev Team
Please use plain text.

Re: GC.Collect causes Node.StopAllActions to throw NullRefException?

This still seems to be broken in 0.98. Can you confirm this has been fixed?

Please use plain text.

Re: GC.Collect causes Node.StopAllActions to throw NullRefException?

Hi YstadYakuza,

Sorry for the delay in response. I will have to re-confirm this in the next week (we're quite busy!).

Thanks again,
James
PlayStation®Mobile Dev Team
Please use plain text.

Re: GC.Collect causes Node.StopAllActions to throw NullRefException?

I understand, thanks.

 

I ran the 0.97 and 0.98 code through a diff program and am pretty sure it wasn't fixed. GameEngine2d was changed a little but nothing to do with this bug.

Please use plain text.

Re: GC.Collect causes Node.StopAllActions to throw NullRefException?

I'm sorry for the late response. I've had another look at the code (the old copy) and I believe that this is down to both the design and debugger. GC is calling the destructor on the Nodes and hitting the NullRefException and obviously removing the GC.Collect call is not ideal. Removing your call to Director.Terminate in your Cleanup() methods will help you get around this issue.

I presume that your terminating at the end of each ScreenBase because you do not know if the next screen will be GE2D generated? Perhaps it is worth handling the Director.Terminate in another way, like keeping it persistent?

The reason why it runs fine without debugging could also be down to how the debugger handles the memory management (keeping the variables in scope).
PlayStation®Mobile Dev Team
Please use plain text.

Re: GC.Collect causes Node.StopAllActions to throw NullRefException?

To me this is just a bug.

 

I've changed a local copy of GE2D so that, as a simple workaround it checks if the var is null before accessing it and this works. But compiling my own GE2D causes much more memory usage.

 

Yes, my library divides work into modes, of which GE2D should be just one.

Please use plain text.
This widget could not be displayed.
Announcements

Welcome to the PlayStation Mobile Developer Forums


This is a community for the discussion of technical topics with other developers and SCE engineers. Posting ideas/requests are also appreciated. Join the discussion!

PlayStation®Mobile開発者フォーラムでは世界中の開発者の皆様と一緒に、議論や情報交換が可能です。SCEも議論に参加し、皆様の開発をサポートします。アイデアやリクエストも大歓迎です。ぜひご参加ください。

PSM Developer Registration (for free) on PSM DevPortal is required to post on the forum.
Please sign out then sign in again to the forum and PSM DevPortal after you have completed the registration.

フォーラムへ投稿をするにはPSM DevPortalへの登録(無料)が必要です。
登録後はフォーラムと PSM DevPortalを一度ログアウトし、再度ログインしてください。






Recent News