Sign in to follow this  

Problem with Circular References

This topic is 1277 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

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

This topic is 1277 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this