Re: memory usage issues in PEAR 1.4.0

From: Date: Sat, 05 Mar 2005 16:17:06 +0000
Subject: Re: memory usage issues in PEAR 1.4.0
References: 1 2 3 4 5 6 7 8  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-36555@lists.php.net to get a copy of this message
Alan Knowles wrote:
I was thinking about this last night - the last step of the installer is to copy the code from the /tmp folder to the live folder, I suspect by the time that happens you would probably not need to load anymore classes.. So lazy loading should not be a big issue.
The problem is that on upgrade, the old files are erased prior to this step in the _deletePackageFiles() method. I've seen this cause a double install in 1.3.5, and other platform-dependent weird things in earlier 1.4.0 versions, it seems to vary a lot from OS to OS since it is a filesystem thing. I've been trying to think of places that I could lazy load the big classes, and I'm really having a hard time. Every time I think of one, I remember having to change that specific case from lazy to non-lazy loading. The generator classes for packagefiles are a perfect example. I had really bizarre behavior in some unit tests, and stepping through with a debugger revealed that lazy loading was the cause. One of the biggest problems is that BC has to be maintained, and so there are some large unused blocks of code (like most of PEAR_Common). In addition, the XML handling in php 4 is so abysmal, I'm forced to re-implement some of the stuff that is built into dom/tidy/simplexml, such as validation, something that takes up a million bytes. By the way, package.xml 2.0 validation is one thing that is lazy-loaded, but it doesn't really save space, because any time you read a package.xml 2.0, it has to be loaded. In fact, most commands in PEAR use every aspect of the code. In order to process the registry, we have to process channels, and also process the dependency database, which needs package.xml 2.0 to convert the dependencies into a standard format, and we need a configuration in order to retrieve php_dir to even find the registry. Downloader/Installer is not used for local commands, but this is pretty small code, not likely to make a difference. To do remote commands, you often need the downloader and PEAR_Remote classes, and you have to use the registry to retrieve the channel servers and what channels are available. Greg

« previous php.pear.dev (#36555) next »