[ 
https://issues.apache.org/jira/browse/ARROW-15228?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17467278#comment-17467278
 ] 

Will Ayd edited comment on ARROW-15228 at 12/31/21, 4:27 PM:
-------------------------------------------------------------

Gotcha. Does that assume then that I have a good idea of the general size of 
the strings I'd eventually be storing? I am dealing with variable sized strings 
whose size I don't know of in advance, though I know how many there are. I'm 
guessing I would still need a safe append in that case?

 

-FWIW even if I add `ARROW_RETURN_NOT_OK(builder->ReserveData(1000));` right 
after the Reserve call in the above example I still run into the same error-


was (Author: willayd):
Gotcha. Does that assume then that I have a good idea of the general size of 
the strings I'd eventually be storing? I am dealing with variable sized strings 
whose size I don't know of in advance, though I know how many there are. I'm 
guessing I would still need a safe append in that case?

 

FWIW even if I add `ARROW_RETURN_NOT_OK(builder->ReserveData(1000));` right 
after the Reserve call in the above example I still run into the same error

> StringBuilder UnsafeAppend causes EXC_BAD_ACCESS
> ------------------------------------------------
>
>                 Key: ARROW-15228
>                 URL: https://issues.apache.org/jira/browse/ARROW-15228
>             Project: Apache Arrow
>          Issue Type: Bug
>            Reporter: Will Ayd
>            Priority: Minor
>
> It seems that StringBuilder->UnsafeAppend produces a memory violation. This 
> is on macOS Monterey with an intel chip if it matters. Below is a sample 
> program that will reproduce the error:
> {code:java}
> #include <arrow/api.h>
> arrow::Status RunMain(int argc, char** argv) {
>   auto builder = std::make_shared<arrow::StringBuilder>();
>   ARROW_RETURN_NOT_OK(builder->Reserve(1));
>   builder->UnsafeAppend(std::string("a"));  
>   return arrow::Status::OK();
> }
> int main(int argc, char** argv) {
>   arrow::Status st = RunMain(argc, argv);
>   if (!st.ok()) {
>     return 1;
>   }
>   return 0;
> }{code}
>  
> I could not reproduce with another builder type



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to