Re: [PHP-DEV] Memory warning hook

2013-03-06 Thread Julien Pauli
One should try ext/memtrack http://pecl.php.net/package/memtrack Also ext/memprof https://github.com/arnaud-lb/php-memory-profiler/ Julien.Pauli On Tue, Mar 5, 2013 at 9:14 PM, nat...@starin.biz wrote: This is not the same at all. When are you going to run this code? Memory allocations

[PHP-DEV] Memory warning hook

2013-03-05 Thread nathan
As PHP applications are turning into large frameworks one of the issues arriving is memory management. One of the issues is that many frameworks use sophisticated caching techniques to make accessing the same data quickly, this improves speed it is at the cost of memory. Often the developer knows

Re: [PHP-DEV] Memory warning hook

2013-03-05 Thread Tom Boutell
Can't you do this already? memory_limit can be fetched via ini_read, and together with memory_get_usage you should be able to check for this sort of thing. Admittedly having to parse memory_limit (which can be in various units) is not perfect. On Tue, Mar 5, 2013 at 1:23 PM, nat...@starin.biz

Re: [PHP-DEV] Memory warning hook

2013-03-05 Thread Johannes Schlüter
On Tue, 2013-03-05 at 12:23 -0600, nat...@starin.biz wrote: As PHP applications are turning into large frameworks one of the issues arriving is memory management. One of the issues is that many frameworks use sophisticated caching techniques to make accessing the same data quickly, this

Re: [PHP-DEV] Memory warning hook

2013-03-05 Thread Lazare Inepologlou
2013/3/5 Tom Boutell t...@punkave.com Can't you do this already? memory_limit can be fetched via ini_read, and together with memory_get_usage you should be able to check for this sort of thing. Admittedly having to parse memory_limit (which can be in various units) is not perfect. This is

Re: [PHP-DEV] Memory warning hook

2013-03-05 Thread Sebastian Krebs
2013/3/5 Lazare Inepologlou linep...@gmail.com 2013/3/5 Tom Boutell t...@punkave.com Can't you do this already? memory_limit can be fetched via ini_read, and together with memory_get_usage you should be able to check for this sort of thing. Admittedly having to parse memory_limit (which

RE: [PHP-DEV] Memory warning hook

2013-03-05 Thread nathan
This is not the same at all. When are you going to run this code? Memory allocations happen all the time. What Nathan asked for is an event that is triggered when the memory consumption reaches a threshold. However, there is a different solution, which is better IMHO in the case of caches: weak