About the APR’s Memory pools which seem to cause memory leaks
Resources: http://en.wikipedia.org/wiki/Apache_Portable_Runtime http://en.wikipedia.org/wiki/Memory_pool http://dev.ariel-networks.com/apr/apr-tutorial/html/apr-tutorial-3.html http://svnbook.red-bean.com/en/1.1/ch08s05.html The APR pools are some big tables which contain references to consecutive memory areas which are used by the application. Once the application releases such an area, the pool marks the memory area as available, but it doesn’t give it back to the OS. Let’s take an example which better illustrates this situation: We have 100 memory areas in the pool, each of 10 K RAM . Some of them are used, some of them not. 10 consecutive objects are released, so we have a block of 100K of continuous memory (in the pool and in the RAM). If there comes a request to reserve 80K of RAM, a big part of this block will be used (8 out of 10 areas). This is reutilization of the pool and from the outside, there will be no memory increase seen. But, if there comes a request to allocate 200K of RAM, the pool doesn’t have enough consecutive areas to allocate 20 blocks of 10K RAM so, it has to allocate 20 new blocks of 10 K. This means from outside, that the pool has been enlarged and this amount of RAM will NOT be released until…