您的位置:首页 > 其它

spark core 2.0 MemoryBlock Soruce Code Analysis

2017-01-22 10:34 218 查看
MemoryBlock contains a consecutive block of memory, starting at a
MemoryLocation with a  fixed size.

public class MemoryBlock extends MemoryLocation {

private final long length;

/**
* Optional page number; used when this MemoryBlock represents a page allocated by a
* TaskMemoryManager. This field is public so that it can be modified by the TaskMemoryManager,
* which lives in a different package.
*/
public int pageNumber = -1;

public MemoryBlock(@Nullable Object obj, long offset, long length) {
super(obj, offset);
this.length = length;
}

/**
* Returns the size in bytes of the memory block.
*/
public long size() {
return length;
}

/**
* Creates a memory block pointing to the memory used by the long array.
*/
public static MemoryBlock fromLongArray(final long[] array) {
return new MemoryBlock(array, Platform.LONG_ARRAY_OFFSET, array.length * 8L);
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: