On 24 Jan 2001 [EMAIL PROTECTED] wrote:

> From:             [EMAIL PROTECTED]
> Operating system: RH 7
> PHP version:      4.0.4
> PHP Bug Type:     Performance problem
> Bug description:  Memory is not being freed.
> 
> Hi guys,
> 
> I do not have much information.  I know that my Apache processes memory is growing 
>by the minute.  If I start a separate server on another port and serve only static 
>pages and files through it, those process do not grow.
> 
> I have tried what I remembered of gdb but have not come up with anything.  I know I 
>need to attach to a process and it seems I can `gdb {pid}` but that gives me nothing. 
> How can I get some info for you guys?  I do have --enable-debug.
> 
> thanks,
> 
> Brian.
> Phorum.org
> 
Ha ! I (my company) have the same problem, there was a quite long
discussion about it (look for mails with phrase "holds memory" in title),
but now you can hear nothing about that topic here... 
I've made some mistakes there, analising the problem, but after
about a week (two ?) I know much more. We are still working on it.

Now I can serve you some simple solution.
There are two memory caches, which are responsible for the observed memory
effect (they do not vary the order of memory operations). They are
implemented in the Zend module.
If you have some experience in recompiling the php source, I can 
help you.
See the file Zend/zend_alloc.c, near line number 39 (I can not say
exactly)

#define ZEND_DISABLE_MEMORY_CACHE 0

You should set this value to 1.

#define ZEND_DISABLE_MEMORY_CACHE 1

And secondary you have to turn off so called fast cache.
To do this, you can add at line 24

#define ZEND_ENABLE_FAST_CACHE 0

to the file Zend/zend_fast_cache.h, so it looks like this now:

...
#ifndef ZEND_FAST_CACHE_H
#define ZEND_FAST_CACHE_H

#define ZEND_ENABLE_FAST_CACHE 0

#ifndef ZEND_ENABLE_FAST_CACHE
# if ZEND_DEBUG
# define ZEND_ENABLE_FAST_CACHE 0
# else
# define ZEND_ENABLE_FAST_CACHE 1
# endif
#endif 
...


Then recompile (all php source, use make clean before for safety)
and install.
This solution turns off memory caches, but from our
tests (on standard RH 6.2 with standard kernel)
we can say, that CPU performance goes down
only less then 10% (it depends on running scripts,
but you can expect MUCH less then 10%, so you may not care).

We have worked out also two more complex solutions, where
there's no need to turn off the first cache.
But this will be described when we finish tests.

Good luck !

PS. Hey, guys from the php-dev. Don't you have anything
to say ? Please do that !


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to