org.apache.ignite.internal.portable.streams

## Class PortableSimpleMemoryAllocator

- java.lang.Object
- - org.apache.ignite.internal.portable.streams.PortableSimpleMemoryAllocator

All Implemented Interfaces:
  PortableMemoryAllocator

    public class PortableSimpleMemoryAllocator
    extends Object
    implements PortableMemoryAllocator

Naive implementation of portable memory allocator.

### Field Summary

Fields
`protected static long` `BYTE_ARR_OFF` Array offset: byte.

### Fields inherited from interface org.apache.ignite.internal.portable.streams.PortableMemoryAllocator

`DFLT_ALLOC`

### Constructor Summary

Constructors
Constructor and Description
`PortableSimpleMemoryAllocator()`

### Method Summary

Methods
`byte[]` `allocate(int size)` Allocate memory.
`long` `allocateDirect(int size)` Allocate memory.
`byte[]` `reallocate(byte[] data, int size)` Reallocates memory.
`long` `reallocateDirect(long addr, int size)` Reallocate memory.
`void` `release(byte[] data, int maxMsgSize)` Release memory.
`void` `releaseDirect(long addr)` Release memory.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### BYTE_ARR_OFF

    protected static final long BYTE_ARR_OFF

Array offset: byte.

### Constructor Detail

#### PortableSimpleMemoryAllocator

    public PortableSimpleMemoryAllocator()

### Method Detail

#### allocate

    public byte[] allocate(int size)

Allocate memory.

Specified by:
  `allocate` in interface `PortableMemoryAllocator`
Parameters:
  `size` - Size.
Returns:
  Data.

#### reallocate

    public byte[] reallocate(byte[] data,
                    int size)

Reallocates memory.

Specified by:
  `reallocate` in interface `PortableMemoryAllocator`
Parameters:
  `data` - Current data chunk.
  `size` - New size required.
Returns:
  Data.

#### release

    public void release(byte[] data,
               int maxMsgSize)

Release memory.

Specified by:
  `release` in interface `PortableMemoryAllocator`
Parameters:
  `data` - Data.
  `maxMsgSize` - Max message size sent during the time the allocator is used.

#### allocateDirect

    public long allocateDirect(int size)

Allocate memory.

Specified by:
  `allocateDirect` in interface `PortableMemoryAllocator`
Parameters:
  `size` - Size.
Returns:
  Address.

#### reallocateDirect

    public long reallocateDirect(long addr,
                        int size)

Reallocate memory.

Specified by:
  `reallocateDirect` in interface `PortableMemoryAllocator`
Parameters:
  `addr` - Address.
  `size` - Size.
Returns:
  Address.

#### releaseDirect

    public void releaseDirect(long addr)

Release memory.

Specified by:
  `releaseDirect` in interface `PortableMemoryAllocator`
Parameters:
  `addr` - Address.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.4.0
Release Date | : September 24 2015