.\" -*-nroff-*-
-.de VS
-.sp 1
-.RS
-.nf
-.ft B
-..
-.de VE
-.ft R
-.fi
-.RE
-.sp 1
-..
-.TH pool 3 "7 July 2000" "Straylight/Edgeware" "mLib utilities library"
-.SH "NAME"
-pool \- resource pool management
+.\"
+.\" Manual for resource pools
+.\"
+.\" (c) 2000, 2001, 2003, 2005, 2007, 2009, 2023, 2024 Straylight/Edgeware
+.\"
+.
+.\"----- Licensing notice ---------------------------------------------------
+.\"
+.\" This file is part of the mLib utilities library.
+.\"
+.\" mLib is free software: you can redistribute it and/or modify it under
+.\" the terms of the GNU Library General Public License as published by
+.\" the Free Software Foundation; either version 2 of the License, or (at
+.\" your option) any later version.
+.\"
+.\" mLib is distributed in the hope that it will be useful, but WITHOUT
+.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
+.\" License for more details.
+.\"
+.\" You should have received a copy of the GNU Library General Public
+.\" License along with mLib. If not, write to the Free Software
+.\" Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+.\" USA.
+.
+.\"--------------------------------------------------------------------------
+.so ../defs.man \" @@@PRE@@@
+.
+.\"--------------------------------------------------------------------------
+.TH pool 3mLib "7 July 2000" "Straylight/Edgeware" "mLib utilities library"
.\" @pool_alloc
.\" @pool_strdup
.\" @pool_init
.\" @pool_fopen
.\" @pool_fclose
.\" @pool_subarena
+.
+.\"--------------------------------------------------------------------------
+.SH "NAME"
+pool \- resource pool management
+.
+.\"--------------------------------------------------------------------------
.SH "SYNOPSIS"
+.
.nf
.B "#include <mLib/pool.h>"
.PP
.BI "void POOL_ADD(pool *" p ", pool_resource *" r ,
.BI " void (*" dfn ")(pool_resource *" r ));
.fi
+.
+.\"--------------------------------------------------------------------------
.SH "DESCRIPTION"
+.
.SS "Overview"
A
.I "resource pool"
will automatically release any resources it has when it's destroyed.
Attaching resources to an appropriate pool can therefore be a useful way
of avoiding memory leaks.
+.
.SS "Creating and destroying pools"
A new root pool is created using
.BR pool_create ,
.BR pool_init ,
on the other hand, are
allocated from a parent pool, and may be reused after being `destroyed'.
+.
.SS "Memory allocation"
Memory is allocated from a pool by calling
.BR pool_alloc ,
.BR p->a ,
which can be passed to other components to cause them to use the pool
for memory allocation.
+.
.SS "Other resources"
Pool resources have a header of type
.B pool_resource
which will ensure that it doesn't get closed twice by accident. It's
advisable to close files by hand, to prevent the process from running
out; it's just not a disaster if you forget by accident.
+.
+.\"--------------------------------------------------------------------------
.SH "SEE ALSO"
+.
.BR alloc (3),
.BR arena (3),
.BR mLib (3),
-.BR subarena (3).
+.BR sub (3).
+.
+.\"--------------------------------------------------------------------------
.SH AUTHOR
+.
Mark Wooding, <mdw@distorted.org.uk>
+.
+.\"----- That's all, folks --------------------------------------------------