Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made refcounting in SGObject use the RefCount class [WIP] #1406

Merged
merged 1 commit into from Aug 14, 2013
Merged

Made refcounting in SGObject use the RefCount class [WIP] #1406

merged 1 commit into from Aug 14, 2013

Conversation

van51
Copy link
Contributor

@van51 van51 commented Aug 13, 2013

Unref also remains to be discussed

SG_GCDEBUG("ref() refcount %ld obj %s (%p) increased\n", count, this->get_name(), this)
return m_refcount;
return m_refcount->ref_count();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before, the m_refcount was returned instead of count, which led me to think that it should return the current ref_count ( since m_refcount could have been increased/decreased again after the unlock() ), instead of the (variable) count in this method.
This is the expected behavior, correct?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m_refcount was an integer with the refcount so yes that should do it. btw you could consider keeping the refcount as part of the object (not a pointer).

@van51
Copy link
Contributor Author

van51 commented Aug 14, 2013

Updated and added a stress test unit case that under helgrind produced no errors. Probably further testing is required. Additionally, I think it should be discussed whether copied objects should always share the RefCount object or not, as well as to select the starting value of the refcounter (since we only delete on ==0 atm) and you mentioned something about SWIG adding + 1?

sonney2k pushed a commit that referenced this pull request Aug 14, 2013
Made refcounting in SGObject use the RefCount class
@sonney2k sonney2k merged commit c2a6ab3 into shogun-toolbox:develop Aug 14, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants