Apache has a nice system where all allocations come out of pools. http://apr.apache.org/docs/apr/2.0/group__apr__pools.html
You can then create a new pool to handle a single http request, then discard the whole pool with one free when the request has finished.