Re: PHP-memory leak with COM-objects?
| From: | TG | Date: | Wed, 10 Oct 2007 13:06:41 +0000 |
| Subject: | Re: PHP-memory leak with COM-objects? | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-28542@lists.php.net to get a copy of this message | ||
One thing to watch out for with using COM objects is to make sure you
actually close the application when you're done using it and/or don't end
up opening multiple instances of the application.
I can't remember what the exactly sequence was, but I think it was either
Application.Exit() or Application.Quit() (or both?). I think the
Application.Close() method just closes the document and not the application
and.. again going on memory here... I believe the default state of the
application was Visible = False, so you wouldn't even see that the
application is still running unless you pulled up the Task Manager.
I don't know anything about memory leaks with this process, just know that
this is one big "gotcha" that can eat up a ton of CPU and memory resources.
For me, COM is a last resort. It's bulky and ugly and has a lot of
potential for things like memory leaks and system instability in general.
You might look to see if there's a PEAR package that can do what you want
to do without using Word directly.
-TG
----- Original Message -----
From: Gustav Wiberg <gustav@hmn.se>
To: 'PHP-Windows Group' <php-windows@lists.php.net>
Date: Wed, 10 Oct 2007 09:36:00 +0200
Subject: [PHP-WIN] PHP-memory leak with COM-objects?
> Hi!
>
> I want to use COM+ objects (especially with Word). I have understood (a lot
> of reading on the Internet) that when initiating COM-objects with Word
> (even if the object is released in variable in the code). Word leaks a
> lot of memory. I have also read that if I want to use Word-COM+ object I
> should have a dedicated server because it takes so much memory.
>
> I have tested some and I easily get out of memory even if there is 4GB on
> the server I tested against.
>
> Then I run PHP as ISAPI, and the suggestion on the php.net site was to run
> PHP as CGI because COM-objects are run in the same memory-space as ISAPI
> when running as ISAPI-module.
> http://php.oregonstate.edu/manual/en/class.com.php
>
>
>
> What do you guys thinks about above? Give me some feedback, please :-)
>
> Best regards
> /Gustav Wiberg
>
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.488 / Virus Database: 269.14.6/1060 - Release Date: 2007-10-09
> 16:43
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>