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

posix_memalign and free function caused crash. #63

Closed
jcai opened this issue Sep 18, 2016 · 6 comments
Closed

posix_memalign and free function caused crash. #63

jcai opened this issue Sep 18, 2016 · 6 comments

Comments

@jcai
Copy link

jcai commented Sep 18, 2016

When I use mingw to compile CRoaring,I implemented posix_memalign .

#ifdef __WIN32__
int posix_memalign(void** mem,size_t alignment,size_t size){
  *mem = _aligned_malloc(size,alignment);
  return 0;
}
#endif

But I found free function caused crash.

/* Free memory. */
void bitset_container_free(bitset_container_t *bitset) {
    free(bitset->array);  // <==============   this line caused crash.
    bitset->array = NULL;
    free(bitset);
}

How to fix ? use _align_free function? I am not sure that all bitset->array was always allocated by posix_memalign function .

@lemire
Copy link
Member

lemire commented Sep 18, 2016

I think you are using an old release. We hopefully fixed this in our last release. Please upgrade to the latest version and let us know.

The latest unity build can be found at https://github.com/lemire/CRoaringUnityBuild

@lemire
Copy link
Member

lemire commented Sep 18, 2016

I am going to close this. Reopen if the problem persists after you upgraded to the latest version.

@lemire lemire closed this as completed Sep 18, 2016
@jcai
Copy link
Author

jcai commented Sep 19, 2016

Thank you very much.After I upgrade to v0.2.7,all works well!

@lemire
Copy link
Member

lemire commented Sep 19, 2016

@RogueException : are you using v0.2.7 as well?

@Auralytical
Copy link
Contributor

0.2.7 fixed my bug as well, thanks @lemire.

@lemire
Copy link
Member

lemire commented Sep 20, 2016

Yes! Victory!

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

No branches or pull requests

3 participants