Andi Gutmans wrote: > At 10:47 AM 6/8/2002 -0700, Brian Pane wrote:
... >> So the simplest case, the lifetime of a pool looks like: >> - create the pool, requiring a lock/unlock >> - do hundreds of allocations from the pool, none of which require >> locking > > > You mean that different threads can allocate/free memory without > requiring locking? How does it accomplish this? Each pool is only allowed to be used by one thread at a time. If the application has multiple threads that need to use the same pool, it's responsible for doing its own synchronization. But for things like the httpd, this is unnecessary: the pool that holds the data for a request is only accessed by the one thread that's handling that request. ... > The thread-private pool is exactly what we need. That's what we're > doing in IIS and it improved performance significantly. > Do I have access to these pools by default? What would be the > equivalent of the MS HeapCreate(HEAP_NO_SERIALIZE, ..) call? If you're > interested take a look at zend_alloc.c and look for Heap. You'll see > all of the relevant places. > If you could work with me on this it would definitely be good for PHP. > We'd just have to find a way to make it work nicely with the SAPI > abstraction. It's no problem #ifdef'ing for WIN32 in zend_alloc.c but > we can't do the same for SAPI modules. I just looked through zend_alloc.c. It looks like the HeapCreate only happens once, at startup--did I get that right? For PHP processing, do you need a memory heap that is created at startup and used by all requests, or is it sufficient to create and destroy a private heap for each request? If it's the latter, then we can probably figure out a way to have the PHP allocator grab memory from the Apache request's pool. But if it's the former (a heap used by many requests), then the problem isn't as easy to solve. --Brian -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php