Jump to content
  • Advertisement
Sign in to follow this  
Marcus L

Problem with Circular References

This topic is 1489 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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)

Share this post


Link to post
Share on other sites
Advertisement

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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!