本文整理了Java中org.jruby.Ruby.getNoMemoryError
方法的一些代码示例,展示了Ruby.getNoMemoryError
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.getNoMemoryError
方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:getNoMemoryError
暂无
代码示例来源:origin: org.jruby/jruby-core
static MemoryPointer allocate(Ruby runtime, int typeSize, int count, boolean clear) {
final int total = typeSize * count;
MemoryIO io = Factory.getInstance().allocateDirectMemory(runtime, total > 0 ? total : 1, clear);
if (io == null) {
throw RaiseException.from(runtime, runtime.getNoMemoryError(),
String.format("Failed to allocate %d objects of %d bytes", count, typeSize));
}
return new MemoryPointer(runtime, runtime.getFFI().memptrClass, io, total, typeSize);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
static MemoryPointer allocate(Ruby runtime, int typeSize, int count, boolean clear) {
final int total = typeSize * count;
MemoryIO io = Factory.getInstance().allocateDirectMemory(runtime, total > 0 ? total : 1, clear);
if (io == null) {
throw new RaiseException(runtime, runtime.getNoMemoryError(),
String.format("Failed to allocate %d objects of %d bytes", count, typeSize), true);
}
return new MemoryPointer(runtime, runtime.getFFI().memptrClass, io, total, typeSize);
}
代码示例来源:origin: org.jruby/jruby-complete
static MemoryPointer allocate(Ruby runtime, int typeSize, int count, boolean clear) {
final int total = typeSize * count;
MemoryIO io = Factory.getInstance().allocateDirectMemory(runtime, total > 0 ? total : 1, clear);
if (io == null) {
throw RaiseException.from(runtime, runtime.getNoMemoryError(),
String.format("Failed to allocate %d objects of %d bytes", count, typeSize));
}
return new MemoryPointer(runtime, runtime.getFFI().memptrClass, io, total, typeSize);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
static MemoryPointer allocate(Ruby runtime, int typeSize, int count, boolean clear) {
final int total = typeSize * count;
MemoryIO io = Factory.getInstance().allocateDirectMemory(runtime, total > 0 ? total : 1, clear);
if (io == null) {
throw new RaiseException(runtime, runtime.getNoMemoryError(),
String.format("Failed to allocate %d objects of %d bytes", count, typeSize), true);
}
return new MemoryPointer(runtime, runtime.getFFI().memptrClass, io, total, typeSize);
}
代码示例来源:origin: org.jruby/jruby-complete
private final IRubyObject init(ThreadContext context, IRubyObject rbTypeSize, int count, int align, boolean clear, Block block) {
typeSize = calculateTypeSize(context, rbTypeSize);
size = typeSize * count;
if (size < 0) {
throw context.runtime.newArgumentError(String.format("Negative size (%d objects of %d size)", count, typeSize));
}
setMemoryIO(Factory.getInstance().allocateDirectMemory(context.runtime,
size > 0 ? (int) size : 1, align, clear));
if (getMemoryIO() == null) {
Ruby runtime = context.runtime;
throw RaiseException.from(runtime, runtime.getNoMemoryError(),
String.format("Failed to allocate %d objects of %d bytes", typeSize, count));
}
if (block.isGiven()) {
try {
return block.yield(context, this);
} finally {
((AllocatedDirectMemoryIO) getMemoryIO()).free();
setMemoryIO(new FreedMemoryIO(context.runtime));
}
} else {
return this;
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
private final IRubyObject init(ThreadContext context, IRubyObject rbTypeSize, int count, int align, boolean clear, Block block) {
typeSize = calculateTypeSize(context, rbTypeSize);
size = typeSize * count;
if (size < 0) {
throw context.runtime.newArgumentError(String.format("Negative size (%d objects of %d size)", count, typeSize));
}
setMemoryIO(Factory.getInstance().allocateDirectMemory(context.runtime,
size > 0 ? (int) size : 1, align, clear));
if (getMemoryIO() == null) {
Ruby runtime = context.runtime;
throw new RaiseException(runtime, runtime.getNoMemoryError(),
String.format("Failed to allocate %d objects of %d bytes", typeSize, count), true);
}
if (block.isGiven()) {
try {
return block.yield(context, this);
} finally {
((AllocatedDirectMemoryIO) getMemoryIO()).free();
setMemoryIO(new FreedMemoryIO(context.runtime));
}
} else {
return this;
}
}
代码示例来源:origin: org.jruby/jruby-core
private final IRubyObject init(ThreadContext context, IRubyObject rbTypeSize, int count, int align, boolean clear, Block block) {
typeSize = calculateTypeSize(context, rbTypeSize);
size = typeSize * count;
if (size < 0) {
throw context.runtime.newArgumentError(String.format("Negative size (%d objects of %d size)", count, typeSize));
}
setMemoryIO(Factory.getInstance().allocateDirectMemory(context.runtime,
size > 0 ? (int) size : 1, align, clear));
if (getMemoryIO() == null) {
Ruby runtime = context.runtime;
throw RaiseException.from(runtime, runtime.getNoMemoryError(),
String.format("Failed to allocate %d objects of %d bytes", typeSize, count));
}
if (block.isGiven()) {
try {
return block.yield(context, this);
} finally {
((AllocatedDirectMemoryIO) getMemoryIO()).free();
setMemoryIO(new FreedMemoryIO(context.runtime));
}
} else {
return this;
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
private final IRubyObject init(ThreadContext context, IRubyObject rbTypeSize, int count, int align, boolean clear, Block block) {
typeSize = calculateTypeSize(context, rbTypeSize);
size = typeSize * count;
if (size < 0) {
throw context.runtime.newArgumentError(String.format("Negative size (%d objects of %d size)", count, typeSize));
}
setMemoryIO(Factory.getInstance().allocateDirectMemory(context.runtime,
size > 0 ? (int) size : 1, align, clear));
if (getMemoryIO() == null) {
Ruby runtime = context.runtime;
throw new RaiseException(runtime, runtime.getNoMemoryError(),
String.format("Failed to allocate %d objects of %d bytes", typeSize, count), true);
}
if (block.isGiven()) {
try {
return block.yield(context, this);
} finally {
((AllocatedDirectMemoryIO) getMemoryIO()).free();
setMemoryIO(new FreedMemoryIO(context.runtime));
}
} else {
return this;
}
}
内容来源于网络,如有侵权,请联系作者删除!