Jump to content

  • Log In with Google      Sign In   
  • Create Account


- - - - -

Problem with Circular References


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Bitsauce   Members   -  Reputation: 233

Like
0Likes
Like

Posted 18 June 2014 - 08:32 AM

Hi again smile.png

So, I've stumbled across a strange issue with circular references. It seems AngelScript doesn't like it when I feed a member variable a reference to its owner (not too surprising, all things considered).

Here is an example of what I mean: (I'm using the "any object"-addon in this example)

class A
{
	any test;
	A()
	{
		test.store(@this);
	}
}

void main()
{
	A a();
}

After running this code, I get the following error messages as I exit my application:

ERR:  (0, 0) : ERR : Object {4}. GC cannot destroy an object of type 'A' as it doesn't know how many references to there are.
ERR:  (0, 0) : ERR : Object {5}. GC cannot destroy an object of type 'any' as it can't see all references. Current ref count is 1.
ERR:  (0, 0) : ERR : Object {76}. GC cannot destroy an object of type '_builtin_objecttype_' as it can't see all references. Current ref count is 2.
INFO:  (0, 0) : INFO : The builtin type in previous message is named 'A'

While this doesn't actually cause any memory leaks as far as I can tell, I still suspect this might lead to problems. I have tried to call scriptEngine->GarbageCollect(asGC_FULL_CYCLE) before scirptEngine->Release(), same result. So now I'm wondering what might be causing this. Is this expected behavior perhaps?

(I'm using AngelScript 2.29.0 btw)



Sponsor:

#2 Bitsauce   Members   -  Reputation: 233

Like
0Likes
Like

Posted 19 June 2014 - 07:38 AM

Never mind. Seems it was a mistake on my part (had modified the EnumReferences callback sleep.png ).
Mods may delete this thread if they wish (the manual answered all my remaining questions).


Edited by Bitsauce, 19 June 2014 - 07:39 AM.


#3 Andreas Jonsson   Moderators   -  Reputation: 3288

Like
0Likes
Like

Posted 19 June 2014 - 09:35 AM

Ah, thanks for confirming that it was not a bug. smile.png


AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#4 Bitsauce   Members   -  Reputation: 233

Like
0Likes
Like

Posted 19 June 2014 - 10:05 AM

No problem smile.png . Sorry if I caused you any headaches!


Edited by Bitsauce, 19 June 2014 - 10:09 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS