Re: Memory trashing
| From: | Manuel Lemos | Date: | Wed, 20 Jan 1999 23:57:46 +0000 |
| Subject: | Re: Memory trashing | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-3652@lists.php.net to get a copy of this message | ||
Hello Rasmus,
On 15-Jan-99 21:20:50, you wrote:
>> Yes, but since it leads to spurious faults, I believe that it would pay to
>> add memory wall trashing to PHP when built in debug mode, so that everybody
>> that is using PHP could report when those problems where found so they can
>> be reported to each person that is responsible of the faulty code. I think
>> PHP could get more useful testing and more people could report those bugs
>> if that code is built-in PHP, don't you think so?
>But, in order to do this properly you have to trap memory allocated from
>third-party libraries as well. To do this you need a much more complex
>approach than simply wrapping just the PHP allocation calls in some code.
You already wrap memory allocation calls in alloc.c. Since it is not
mandatory that third party libraries use PHP allocation calls, it wouldn't
affect wether or not those allocations will be kept track.
We could encourage third party library developers to use PHP allocation
calls to benefit or memory checking detection but it wouldn't hurt if they
were not used by some extensions.
>A tool like Purify or even the bounds checking version of gcc will do a
>much better job of this than any tricks we could add to PHP.
I'm afraid that's not quite true. Most users don't have those tools either
because they are commerciall or not widely available in ready to use form.
Anyway, what I have in mind is a simple thing like checking memory when it
is being freed, not exactly when offending code hits memory boundaries
walls like tools like Electric Fence do.
Given that you already track allocated memory it would only take a few
extra lines to add memory wall setup on allocation and verification on
free. Since such code would only be compiled when PHP is built for
debugging, it wouldn't affect code size or performance in production
version.
I see no disadvantage in having this kind of memory tracking support unless
you just don't feel like doing it. In that case I may volunteer to do it
myself.
Regards,
Manuel Lemos
E-mail: mlemos@acm.org
URL: http://www.e-na.net/the_author.html
PGP key: finger://mlemos@zeus.ci.ua.pt
--
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net