| 388 | } |
| 389 | |
| 390 | forceinline void* |
| 391 | Heap::rrealloc(void* p, size_t s) { |
| 392 | #ifdef GECODE_PEAKHEAP |
| 393 | _m.acquire(); |
| 394 | _cur -= GECODE_MSIZE(p); |
| 395 | _m.release(); |
| 396 | #endif |
| 397 | p = Support::allocator.realloc(p,s); |
| 398 | #ifdef GECODE_PEAKHEAP |
| 399 | _m.acquire(); |
| 400 | _cur += GECODE_MSIZE(p); |
| 401 | _peak = std::max(_peak,_cur); |
| 402 | _m.release(); |
| 403 | #endif |
| 404 | if (p != nullptr || s == 0) |
| 405 | return p; |
| 406 | throw MemoryExhausted(); |
| 407 | } |
| 408 | |
| 409 | |
| 410 | /* |