You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@arrow.apache.org by Li Jin <ic...@gmail.com> on 2018/12/06 16:37:42 UTC

Thread-safety of buffer allocators in Java

Hey folks,

I am studying a bit of the buffer allocators code in the Java library. From
my understanding of the code, the buffer allocators are thread safe. i.e.,
you can use the same buffer allocator to multiple threads, as well as
creating child allocators from the same allocator and use them in different
threads.

Is my understanding correct? I also get this question from other users so I
think it will be helpful to put that in the doc as well.

Thanks,
Li

Re: Thread-safety of buffer allocators in Java

Posted by Li Jin <ic...@gmail.com>.
Thanks Jacques!

On Sun, Dec 9, 2018 at 6:47 AM Jacques Nadeau <ja...@apache.org> wrote:

> Yes, that is true. Allocators, buffers and pretty much everything inbetween
> is thread safe. Locking around the memory backing a buffer itself needs to
> be managed in the app. You can review the doc here which talks more about
> the structure of the allocators:
>
>
> https://github.com/apache/arrow/blob/master/java/memory/src/main/java/org/apache/arrow/memory/README.md
>
>
> On Thu, Dec 6, 2018 at 10:08 PM Li Jin <ic...@gmail.com> wrote:
>
> > Hey folks,
> >
> > I am studying a bit of the buffer allocators code in the Java library.
> From
> > my understanding of the code, the buffer allocators are thread safe.
> i.e.,
> > you can use the same buffer allocator to multiple threads, as well as
> > creating child allocators from the same allocator and use them in
> different
> > threads.
> >
> > Is my understanding correct? I also get this question from other users
> so I
> > think it will be helpful to put that in the doc as well.
> >
> > Thanks,
> > Li
> >
>

Re: Thread-safety of buffer allocators in Java

Posted by Jacques Nadeau <ja...@apache.org>.
Yes, that is true. Allocators, buffers and pretty much everything inbetween
is thread safe. Locking around the memory backing a buffer itself needs to
be managed in the app. You can review the doc here which talks more about
the structure of the allocators:

https://github.com/apache/arrow/blob/master/java/memory/src/main/java/org/apache/arrow/memory/README.md


On Thu, Dec 6, 2018 at 10:08 PM Li Jin <ic...@gmail.com> wrote:

> Hey folks,
>
> I am studying a bit of the buffer allocators code in the Java library. From
> my understanding of the code, the buffer allocators are thread safe. i.e.,
> you can use the same buffer allocator to multiple threads, as well as
> creating child allocators from the same allocator and use them in different
> threads.
>
> Is my understanding correct? I also get this question from other users so I
> think it will be helpful to put that in the doc as well.
>
> Thanks,
> Li
>