+/* ============== CLASS POOL_MEM ============== */
+
+/* Return the size of a memory buffer */
+int32_t POOL_MEM::max_size()
+{
+ int32_t size;
+ char *cp = mem;
+ cp -= HEAD_SIZE;
+ size = ((struct abufhead *)cp)->ablen;
+ Dmsg1(900, "max_size=%d\n", size);
+ return size;
+}
+
+void POOL_MEM::realloc_pm(int32_t size)
+{
+ char *cp = mem;
+ char *buf;
+ int pool;
+
+ P(mutex);
+ cp -= HEAD_SIZE;
+ buf = (char *)realloc(cp, size+HEAD_SIZE);
+ if (buf == NULL) {
+ V(mutex);
+ Emsg1(M_ABORT, 0, _("Out of memory requesting %d bytes\n"), size);
+ }
+ Dmsg2(900, "Old buf=%p new buf=%p\n", cp, buf);
+ ((struct abufhead *)buf)->ablen = size;
+ pool = ((struct abufhead *)buf)->pool;
+ if (size > pool_ctl[pool].max_allocated) {
+ pool_ctl[pool].max_allocated = size;
+ }
+ mem = buf+HEAD_SIZE;
+ V(mutex);
+ Dmsg3(900, "Old buf=%p new buf=%p mem=%p\n", cp, buf, mem);
+}
+