[Numpy-discussion] Shared memory ndarrays (update)

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Mon Apr 11 08:58:42 EDT 2011


On 04/11/2011 09:21 AM, Sebastian Haase wrote:

> I have a non python question:
> for Java there seems to exist a module/package/class called nio
> 
> http://download.oracle.com/javase/1.4.2/docs/api/java/nio/MappedByteBuffer.html
>    public abstract class MappedByteBuffer    extends ByteBuffer
>    A direct byte buffer whose content is a memory-mapped region of a file.
> 
> Could this be used to share memory between   Java applications  and  numpy ?
Hi,
it could, but you'd have to do the parsing of data yourself. So nothing
fancy unless you want to reimplement numpy in Java :). But if you
use a mmaped file as a backing for a numpy array of one of the types
also available in Java (signed byte, short, int, long, float, double)
and then map it on the Java side with DoubleBuffer or FloatBuffer or
..., then it seems straightforward enough.

Zbyszek



More information about the NumPy-Discussion mailing list