Results 1 to 6 of 6

Thread: objects staying in memory - RESOLVED

  1. #1

    Thread Starter
    Hyperactive Member stingrae's Avatar
    Join Date
    Apr 2002
    Location
    Sydney
    Posts
    401

    objects staying in memory - RESOLVED

    what do people here think is the best way to remove an object from memory? for example, if have:

    Code:
            Dim wrdApp As New Word.Application()
            Dim wrdDoc As Word.Document
              :
              :
              :
              :
            wrdDoc = Nothing
            wrdApp = Nothing
    now when i step through the code with the windows task manager open (viewing processes), I see winword.exe appear after the line "dim wrdApp" in the code.

    however, after i set wrdApp to nothing, the file is still running around. hence after running this code 6 times, i have 6 different instances of winword.exe running.

    i have tried using GC.Dispose but this too does nothing to the processes.

    does anyone have any better ideas or suggestions?
    Last edited by stingrae; Mar 10th, 2003 at 06:44 PM.
    "The passion lives to keep your faith, though all are different, all are great" ... Michael Hutchence 1960-1997.

    Windows & Web Developer
    Specialising in Visual Basic .Net & Client Server Programming & Client/Customer Relations Databases
    Sutherland Shire, Sydney Australia
    www.stingrae.com.au
    Developer of Arnold - Gym & Martial Arts Database Management System
    www.gymdatabase.com.au

  2. #2
    Fanatic Member robbedaya's Avatar
    Join Date
    Jul 2002
    Location
    Belgium
    Posts
    872
    GC.collect
    - Use the thread tools to Mark your Thread as Resolved when your question is answered.
    - Please Rate my answers if they where helpful.

  3. #3

    Thread Starter
    Hyperactive Member stingrae's Avatar
    Join Date
    Apr 2002
    Location
    Sydney
    Posts
    401
    oops. i meant GC.Collect instead of GC.Dispose.
    that didn't work for me.

    cheers,

    stingrae
    "The passion lives to keep your faith, though all are different, all are great" ... Michael Hutchence 1960-1997.

    Windows & Web Developer
    Specialising in Visual Basic .Net & Client Server Programming & Client/Customer Relations Databases
    Sutherland Shire, Sydney Australia
    www.stingrae.com.au
    Developer of Arnold - Gym & Martial Arts Database Management System
    www.gymdatabase.com.au

  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    That happens in vb.net environment , I was having similar problem .I was trying to force GC to fire as need but it works in random interval.anyways, why don't you try another way ,such this

    Kill an Application
    dunno if it's of help .

  5. #5

    Thread Starter
    Hyperactive Member stingrae's Avatar
    Join Date
    Apr 2002
    Location
    Sydney
    Posts
    401
    thanks pirate, nice idea.
    do you know what happens though if the user has other instances of word open? will it close the one that my application opened, or close all?
    "The passion lives to keep your faith, though all are different, all are great" ... Michael Hutchence 1960-1997.

    Windows & Web Developer
    Specialising in Visual Basic .Net & Client Server Programming & Client/Customer Relations Databases
    Sutherland Shire, Sydney Australia
    www.stingrae.com.au
    Developer of Arnold - Gym & Martial Arts Database Management System
    www.gymdatabase.com.au

  6. #6

    Thread Starter
    Hyperactive Member stingrae's Avatar
    Join Date
    Apr 2002
    Location
    Sydney
    Posts
    401
    took me 3 months, but i finally figured it out!



    Code:
    Dim wrdDoc As Word.Document
    .
    .
    .
    .
    CType(wrdDoc, Word._Document).Close()
    "The passion lives to keep your faith, though all are different, all are great" ... Michael Hutchence 1960-1997.

    Windows & Web Developer
    Specialising in Visual Basic .Net & Client Server Programming & Client/Customer Relations Databases
    Sutherland Shire, Sydney Australia
    www.stingrae.com.au
    Developer of Arnold - Gym & Martial Arts Database Management System
    www.gymdatabase.com.au

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width