-
-
Notifications
You must be signed in to change notification settings - Fork 276
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
Too many Xbyak::Allocator::alloc call produces mprotect failure #13
Comments
This is monkey patching allocator. free/alloc should be extended to take the size parameter of the memory to be processed. ref: herumi/xbyak#13
そんな制限があったのですね。mprotectがmmapした領域をmunmapできたらいいのですがちょっと調べてみます。posix_memalignの代わりにmmapは互換性を確保できるか気になりますね。 |
posix_memalignした領域をmprotectした場合は同時に33000個ぐらいのインスタンスを生成するとエラーになるけどmmapした領域に対しては同時にもっと作れるのですね。 |
I created MmapAllocator branch. |
Thank you! Looks good to me. |
Thank you for your very kind message. |
Thank you for your quick response!! |
Hi, thank you for your great library.
I found that sometimes
mprotect
fails it's modification to the page attribues.For example, in this test, we observe it several times. https://travis-ci.org/Constellation/iv/jobs/37578037.
In this test, the test script requires xbyak's code generation huge times. (
16 ** 4 = 65536
times)After investigating this problem, I've found that
mprotect
with valid parameters (address and size are valid) fails withENOMEM
, and it seems that this is because the map count becomes zero (Maybe I think).ref:
ENOMEM
mmap
andmprotect
consume map count.Since xbyak's dynamic memory allocator calls
mprotect
, but doesn't callmunmap
,map count
doesn't released.To prevent it, I suggest the following plan.
mmap
instead ofposix_memalign
munmap
What do you think about it?
The text was updated successfully, but these errors were encountered: