MCPcopy Create free account
hub / github.com/java-native-access/jna / Memory

Method Memory

src/com/sun/jna/Memory.java:112–123  ·  view source on GitHub ↗

Allocate space in the native heap via a call to C's malloc . @param size number of bytes of space to allocate

(long size)

Source from the content-addressed store, hash-verified

110 * @param size number of <em>bytes</em> of space to allocate
111 */
112 public Memory(long size) {
113 this.size = size;
114 if (size <= 0) {
115 throw new IllegalArgumentException("Allocation size must be greater than zero");
116 }
117 peer = malloc(size);
118 if (peer == 0)
119 throw new OutOfMemoryError("Cannot allocate " + size + " bytes");
120
121 allocatedMemory.put(peer, new WeakReference<>(this));
122 cleanable = Cleaner.getCleaner().register(this, new MemoryDisposer(peer));
123 }
124
125 protected Memory() {
126 super();

Callers

nothing calls this directly

Calls 4

mallocMethod · 0.95
getCleanerMethod · 0.95
putMethod · 0.80
registerMethod · 0.45

Tested by

no test coverage detected