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

Method realloc

core/src/main/java/io/questdb/std/Unsafe.java:410–432  ·  view source on GitHub ↗
(long address, long oldSize, long newSize, int memoryTag)

Source from the content-addressed store, hash-verified

408 }
409
410 public static long realloc(long address, long oldSize, long newSize, int memoryTag) {
411 try {
412 assert memoryTag >= MemoryTag.NATIVE_PATH;
413 checkAllocLimit(-oldSize + newSize, memoryTag);
414 long ptr = UNSAFE.reallocateMemory(address, newSize);
415 recordMemAlloc(-oldSize + newSize, memoryTag);
416 incrReallocCount();
417 return ptr;
418 } catch (OutOfMemoryError oom) {
419 CairoException e = CairoException.nonCritical().setOutOfMemory(true)
420 .put("sun.misc.Unsafe.reallocateMemory() OutOfMemoryError [RSS_MEM_USED=")
421 .put(getRssMemUsed())
422 .put(", oldSize=")
423 .put(oldSize)
424 .put(", newSize=")
425 .put(newSize)
426 .put(", memoryTag=").put(memoryTag)
427 .put("], original message: ")
428 .put(oom.getMessage());
429 System.err.println(e.getFlyweightMessage());
430 throw e;
431 }
432 }
433
434 public static void recordMemAlloc(long size, int memoryTag) {
435 assert memoryTag >= 0 && memoryTag < MemoryTag.SIZE;

Callers 15

resizeMethod · 0.95
growBufferMethod · 0.95
ensureEntriesCapacityMethod · 0.95
ensureHeapCapacityMethod · 0.95
ensureValuesCapacityMethod · 0.95
recordStringOffsetMethod · 0.95

Calls 11

checkAllocLimitMethod · 0.95
recordMemAllocMethod · 0.95
incrReallocCountMethod · 0.95
nonCriticalMethod · 0.95
getRssMemUsedMethod · 0.95
getFlyweightMessageMethod · 0.95
reallocateMemoryMethod · 0.80
setOutOfMemoryMethod · 0.80
putMethod · 0.65
getMessageMethod · 0.45
printlnMethod · 0.45

Tested by

no test coverage detected