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

add ReleaseObject and PreserveObject to protect memory from GC #6

Merged
merged 1 commit into from
Jan 7, 2015
Merged

Conversation

randy3k
Copy link
Member

@randy3k randy3k commented Jan 7, 2015

It is important when memory of an R object is referenced by a julia variable.

using RCall
x = Reval(Rparse("x = 1:10^8"))
RCall.PreserveObject(x)
y = RCall.rawvector(x);
Reval(Rparse("x = 1"))
for(i in 1:10) 
    Reval(Rparse("gc()"));
end
y

without the RCall.PreserveObject statement, the last y will produce segfault.

dmbates added a commit that referenced this pull request Jan 7, 2015
add ReleaseObject and PreserveObject to protect memory from GC
@dmbates dmbates merged commit f3e115f into JuliaInterop:master Jan 7, 2015
@randy3k randy3k deleted the patch2 branch January 7, 2015 18:53
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