Reference count is 1 after construction?

From most of the descriptions I’ve read the reference count of a cocos2dx object created via a static create() function should be 0, such that if it isn’t added as a child or retained then it gets autoreleased before the next frame. However I’m seeing for cocos2d::Layer and others I quickly tested that the reference count is 1 and so they don’t get removed.

Is this behaviour expected, should I be seeing this?

I’m using 3.15, thanks.

Well I answered my own question. The reference count is 1 but autorelease() when called schedules the reference count to be reduced by 1 at the next maintenance cycle so they are actually destroyed. A little confusing but now it makes sense. I do feel like I’ve trodden this path once already though, shoudl’ve taken more notes :stuck_out_tongue:

1 Like