Results 1 to 10 of 10

Thread: restart application

  1. #1

    Thread Starter
    Registered User
    Join Date
    Jul 2001
    Posts
    283

    restart application

    what is the simplest way to restart my application and clear all variables from ram?

    thanks.

  2. #2
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    Start another instance and close the first one

  3. #3

    Thread Starter
    Registered User
    Join Date
    Jul 2001
    Posts
    283
    how?
    do you have some code?

  4. #4
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    Originally posted by marvinklein
    how?
    do you have some code?
    .....

    System.Process.Start("MyProgram.exe")
    me.close()

    It may not be the most efficient way (since it loads a copy of the program, then the other closes), but it is the easyest.

  5. #5

    Thread Starter
    Registered User
    Join Date
    Jul 2001
    Posts
    283
    Originally posted by kasracer
    .....

    System.Process.Start("MyProgram.exe")
    me.close()

    It may not be the most efficient way (since it loads a copy of the program, then the other closes), but it is the easyest.

    anybody have some ideas on the most efficient way of doing this?

  6. #6
    Member
    Join Date
    May 2003
    Posts
    58
    If what you want is only to free up more resources, you can call GC.Collect() function to request the garbage collection to free up all unused resources. This way you can re-gain resources without restarting your application.

  7. #7
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by Volvere
    If what you want is only to free up more resources, you can call GC.Collect() function to request the garbage collection to free up all unused resources. This way you can re-gain resources without restarting your application.
    Before this ,
    add all your class level variables in destructors(or Dispose() method and call it when you're done of your obj class) and they will be disposed when that instance of the object is no longer used . This is the most efficient way plus explicitly calling GC .

  8. #8

    Thread Starter
    Registered User
    Join Date
    Jul 2001
    Posts
    283
    Originally posted by Pirate

    add all your class level variables in destructors(or Dispose() method and call it when you're done of your obj class) and they will be disposed when that instance of the object is no longer used . This is the most efficient way plus explicitly calling GC .
    how do you destruct variables or classes?
    i know you can do myform.unload...
    but how do you dispose arrays or things like that?



    on a different, (maybe related??)
    also, there is a standard function in classes New()
    i know how to use that.
    but what does the function finalize() do?

  9. #9
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

  10. #10

    Thread Starter
    Registered User
    Join Date
    Jul 2001
    Posts
    283
    thanks pirate. that's really helpful.

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