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

Method unmap0

core/src/main/java/io/questdb/std/MmapCache.java:452–481  ·  view source on GitHub ↗
(long address, long len, int memoryTag)

Source from the content-addressed store, hash-verified

450 }
451
452 private void unmap0(long address, long len, int memoryTag) {
453 if (Files.ASYNC_MUNMAP_ENABLED) {
454 // sequence returning -2 -> we lost a CAS race. we do a cheap retry
455 // sequence returning -1 -> the queue is full. then it's cheaper to do the munmap ourserlves
456 long seq;
457 while ((seq = munmapProducesSequence.next()) == -2) {
458 Os.pause();
459 }
460
461 if (seq > -1) {
462 MunmapTask task = munmapTaskRingQueue.get(seq);
463 task.address = address;
464 task.size = len;
465 task.memoryTag = memoryTag;
466 munmapProducesSequence.done(seq);
467 return;
468 } else {
469 LOG.info().$("async munmap queue is full").$();
470 }
471 }
472 int result = Files.munmap0(address, len);
473 if (result != -1) {
474 Unsafe.recordMemAlloc(-len, memoryTag);
475 } else {
476 throw CairoException.critical(Os.errno())
477 .put("munmap failed [address=").put(address)
478 .put(", len=").put(len)
479 .put(", memoryTag=").put(memoryTag).put(']');
480 }
481 }
482
483 /**
484 * Cache record holding memory mapping details and reference count.

Callers 3

mremapMethod · 0.95
unmapMethod · 0.95
cacheMmapOptimisticMethod · 0.95

Calls 11

pauseMethod · 0.95
munmap0Method · 0.95
recordMemAllocMethod · 0.95
criticalMethod · 0.95
errnoMethod · 0.95
nextMethod · 0.65
getMethod · 0.65
doneMethod · 0.65
$Method · 0.65
infoMethod · 0.65
putMethod · 0.65

Tested by

no test coverage detected