MCPcopy Index your code
hub / github.com/questdb/questdb / malloc

Method malloc

core/src/main/java/io/questdb/std/Unsafe.java:324–344  ·  view source on GitHub ↗
(long size, int memoryTag)

Source from the content-addressed store, hash-verified

322 }
323
324 public static long malloc(long size, int memoryTag) {
325 try {
326 assert memoryTag >= MemoryTag.NATIVE_PATH;
327 checkAllocLimit(size, memoryTag);
328 long ptr = UNSAFE.allocateMemory(size);
329 recordMemAlloc(size, memoryTag);
330 incrMallocCount();
331 return ptr;
332 } catch (OutOfMemoryError oom) {
333 CairoException e = CairoException.nonCritical().setOutOfMemory(true)
334 .put("sun.misc.Unsafe.allocateMemory() OutOfMemoryError [RSS_MEM_USED=")
335 .put(getRssMemUsed())
336 .put(", size=")
337 .put(size)
338 .put(", memoryTag=").put(memoryTag)
339 .put("], original message: ")
340 .put(oom.getMessage());
341 System.err.println(e.getFlyweightMessage());
342 throw e;
343 }
344 }
345
346 public static long objectFieldOffset(Field f) {
347 return UNSAFE.objectFieldOffset(f);

Callers 15

assertRawArrayMethod · 0.95
testMixedIOConcurrentMethod · 0.95
testReadFailsMethod · 0.95
testReadOver2GBMethod · 0.95
testSendFileOver2GBMethod · 0.95
testWriteFailsMethod · 0.95
testWriteOver2GBMethod · 0.95
createTempFileMethod · 0.95
assertEqualsMethod · 0.95
putUtf8Method · 0.95

Calls 11

checkAllocLimitMethod · 0.95
recordMemAllocMethod · 0.95
incrMallocCountMethod · 0.95
nonCriticalMethod · 0.95
getRssMemUsedMethod · 0.95
getFlyweightMessageMethod · 0.95
setOutOfMemoryMethod · 0.80
putMethod · 0.65
allocateMemoryMethod · 0.45
getMessageMethod · 0.45
printlnMethod · 0.45

Tested by 15

assertRawArrayMethod · 0.76
testMixedIOConcurrentMethod · 0.76
testReadFailsMethod · 0.76
testReadOver2GBMethod · 0.76
testSendFileOver2GBMethod · 0.76
testWriteFailsMethod · 0.76
testWriteOver2GBMethod · 0.76
createTempFileMethod · 0.76
assertEqualsMethod · 0.76
putUtf8Method · 0.76