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

Method checkAllocLimit

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

Source from the content-addressed store, hash-verified

456 }
457
458 private static void checkAllocLimit(long size, int memoryTag) {
459 if (size <= 0) {
460 return;
461 }
462 // Don't check limits for mmap'd memory
463 final long rssMemLimit = getRssMemLimit();
464 if (rssMemLimit > 0 && memoryTag >= NATIVE_DEFAULT) {
465 long usage = getRssMemUsed();
466 if (usage + size > rssMemLimit) {
467 throw CairoException.nonCritical().setOutOfMemory(true)
468 .put("global RSS memory limit exceeded [usage=")
469 .put(usage)
470 .put(", RSS_MEM_LIMIT=").put(rssMemLimit)
471 .put(", size=").put(size)
472 .put(", memoryTag=").put(memoryTag)
473 .put(']');
474 }
475 }
476 }
477
478 /**
479 * Allocate a new native allocator object and return its pointer

Callers 2

mallocMethod · 0.95
reallocMethod · 0.95

Calls 5

getRssMemLimitMethod · 0.95
getRssMemUsedMethod · 0.95
nonCriticalMethod · 0.95
setOutOfMemoryMethod · 0.80
putMethod · 0.65

Tested by

no test coverage detected