![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | closing object - removing from memory PoSH crew, How can I cleanly close an object and remove it from memory? I've been reading most of the day and trying things but I can't figure it out (I can use get-process/stop-process, but there must be a friendlier way). Specifically I am creating a Excel object: >$xl = new-object -com excel.application How can I close this object and clear it from memory? >$xl.quit() does nothin' Cheers, Neil |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: closing object - removing from memory actually, Klumsy on #powershell pointed out to me that the object had actually ended but a couple of things can be done to speed up recovery: 1 - nuke the variable >del variable:\xl 2 - Invoke the Garbage Collector [gc]::Collect() :-) "Neil Chambers" <nospamplease@nospam.com> wrote in message news:EA2BA9DE-300A-4D30-8CB6-10D896414991@microsoft.com... > PoSH crew, > > How can I cleanly close an object and remove it from memory? I've been > reading most of the day and trying things but I can't figure it out (I can > use get-process/stop-process, but there must be a friendlier way). > > Specifically I am creating a Excel object: > >>$xl = new-object -com excel.application > > How can I close this object and clear it from memory? > >>$xl.quit() > > does nothin' > > Cheers, > Neil |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: closing object - removing from memory Many objects have a Dispose() method -- Richard Siddaway Please note that all scripts are supplied "as is" and with no warranty Blog: http://richardsiddaway.spaces.live.com/ PowerShell User Group: http://www.get-psuguk.org.uk "Neil Chambers" wrote: > actually, Klumsy on #powershell pointed out to me that the object had > actually ended but a couple of things can be done to speed up recovery: > > 1 - nuke the variable > >del variable:\xl > > 2 - Invoke the Garbage Collector > > [gc]::Collect() > > > :-) > "Neil Chambers" <nospamplease@nospam.com> wrote in message > news:EA2BA9DE-300A-4D30-8CB6-10D896414991@microsoft.com... > > PoSH crew, > > > > How can I cleanly close an object and remove it from memory? I've been > > reading most of the day and trying things but I can't figure it out (I can > > use get-process/stop-process, but there must be a friendlier way). > > > > Specifically I am creating a Excel object: > > > >>$xl = new-object -com excel.application > > > > How can I close this object and clear it from memory? > > > >>$xl.quit() > > > > does nothin' > > > > Cheers, > > Neil > |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| datalist -- Object reference not set to an instance of an object. | Deere | .NET General | 0 | 08-31-2008 09:09 AM |
| Windows Mail keeps closing because DEP is closing for security | Window Mail DEP message | Vista mail | 7 | 05-23-2007 05:59 AM |
| Testing object arrays using Compare-Object and -contains | Alex K. Angelopoulos [MVP] | PowerShell | 2 | 08-31-2006 05:57 PM |
| Adding canonical aliases for Compare-Object, Measure-Object, New-Object | Alex K. Angelopoulos [MVP] | PowerShell | 2 | 05-26-2006 07:58 AM |