(long size, int memoryTag)
| 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 |
no test coverage detected