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

pointer to invalid memory in MDBValue? #12

Closed
tanmaykm opened this issue Nov 13, 2017 · 2 comments
Closed

pointer to invalid memory in MDBValue? #12

tanmaykm opened this issue Nov 13, 2017 · 2 comments

Comments

@tanmaykm
Copy link
Contributor

Here in the MDBValue constructor, if val <: Number, won't the pointer to the array created be invalid after the constructor returns? In that case, that memory region may contain garbage by the time the data gets stored in the database.

@wildart
Copy link
Owner

wildart commented Nov 13, 2017

Yes, it's problem. The value memory could be swept by GC. I guess explicit numeric MDBValue type that would hold number will solve this issue.

tanmaykm added a commit to tanmaykm/LMDB.jl that referenced this issue Nov 14, 2017
- prevent possible invalid ptr for `Number` types by holding a reference utill `ccall` returns (fixes wildart#12)
- allow using any immutable bits types to be used in keys and values (fixes wildart#13)
tanmaykm added a commit to tanmaykm/LMDB.jl that referenced this issue Nov 14, 2017
- prevent possible invalid ptr for `Number` types by holding a reference utill `ccall` returns (fixes wildart#12)
- allow using any immutable bits types to be used in keys and values (fixes wildart#13)
@wildart
Copy link
Owner

wildart commented Nov 17, 2017

Closed by #14

@wildart wildart closed this as completed Nov 17, 2017
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 a pull request may close this issue.

2 participants