Clearing Memory

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • malligarjunank
    New Member
    • Apr 2007
    • 10

    #1

    Clearing Memory

    Hi All,

    I am creating an instance many times for a class in Runtime(for a minute it will create 100 instance).

    That thread is running 24 Hrs /Day.

    How to clear the memory which was created by those thread.


    Pls Give me a solution.
  • Shashi Sadasivan
    Recognized Expert Top Contributor
    • Aug 2007
    • 1435

    #2
    The inbuilt garbage collector should do it by itself!

    If not use the GC class

    cheers

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #3
      You should try and find ways to close all file handles (sockets, files, streams, whatever) call .Close() on anything that has it, .Dispose() on anything that has it.
      Then as a last resort you can use GC.Collect(); to clear up anything left over.


      I'm actually in the process of doing this right now myself.

      Comment

      • malligarjunank
        New Member
        • Apr 2007
        • 10

        #4
        Originally posted by Plater
        You should try and find ways to close all file handles (sockets, files, streams, whatever) call .Close() on anything that has it, .Dispose() on anything that has it.
        Then as a last resort you can use GC.Collect(); to clear up anything left over.


        I'm actually in the process of doing this right now myself.
        Hi Thanks for ur solution. Now i am working with designing a server using socket programming. so it will available for 24X7 . Is there any chance clearing memories in this regard

        Comment

        • Plater
          Recognized Expert Expert
          • Apr 2007
          • 7872

          #5
          What do mean clearing memory with the socket?
          Remember to close all your Sockets (and any underlying streams, look at the descriptions of the functions if you are unsure)

          Comment

          Working...