-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
fixes 1220: rocksjni build fails on Windows due to variable-size array declaration #1223
Conversation
…y declaration using new keyword to create variable-size arrays in order to satisfy most of the compilers
@clumsy If you allocate memory with |
How is it different from the current approach in terms of deleting the memory? |
@clumsy The current approach is allocated on the stack, but with |
Ok, thanks for the clarification. In that case will a E.g.:
|
@clumsy The above would be allocated on the heap yes, but I do not know if that fixes the issue you are addressing on Windows. If it does then that is the simplest solution. If not, then you just need to add |
No other solution is working for Visual Studio 15 C++ compiler on Windows. |
@clumsy To do it right wrap it into The other way of doing this is to do alloca() then no delete is necessary and the space is allocated as before on the stack. Search for alloca() in the code as I have seen this issue before. |
Ok, found a solution for unique_ptr as suggested by @yuslepukhin: ttl.cc:
options.cc:
rocksjni.cc:
Will update my patch shortly. |
…y declaration using unique_ptr keyword to create variable-size arrays in order to satisfy most of the compilers
Please check most recent commit. |
wrap it into std::unique_ptr<char[]> sounds good to me. |
LGTM. Merged it. |
Closes #1220 |
using new keyword to create variable-size arrays in order to satisfy most of the compilers