Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Garbage Collector

Garbage Collector

Scheduled Pinned Locked Moved ASP.NET
databasetutorialquestion
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    miniThomas
    wrote on last edited by
    #1

    I need to write code to force garbage collection and add whatever values i get in DB,How to go about it? Mini Thomas

    L 1 Reply Last reply
    0
    • M miniThomas

      I need to write code to force garbage collection and add whatever values i get in DB,How to go about it? Mini Thomas

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You can start with System.GC.Collect(). There is an overload that will allow you to specify the generation to collect also. I highly recommend you let the GC do things by itself because forcing garbage collection messes up its tuning and timing.

      █▒▒▒▒▒██▒█▒██ █▒█████▒▒▒▒▒█ █▒██████▒█▒██ █▒█████▒▒▒▒▒█ █▒▒▒▒▒██▒█▒██

      A 1 Reply Last reply
      0
      • L Lost User

        You can start with System.GC.Collect(). There is an overload that will allow you to specify the generation to collect also. I highly recommend you let the GC do things by itself because forcing garbage collection messes up its tuning and timing.

        █▒▒▒▒▒██▒█▒██ █▒█████▒▒▒▒▒█ █▒██████▒█▒██ █▒█████▒▒▒▒▒█ █▒▒▒▒▒██▒█▒██

        A Offline
        A Offline
        Amit Kumar G
        wrote on last edited by
        #3

        i fully agree with you. Why you need explicit call to GC. Can you share the reason. ? Amit

        M L 2 Replies Last reply
        0
        • A Amit Kumar G

          i fully agree with you. Why you need explicit call to GC. Can you share the reason. ? Amit

          M Offline
          M Offline
          miniThomas
          wrote on last edited by
          #4

          I am writing a program to collect values u fetch from System.GC.Collect () into DB Mini Thomas

          L 1 Reply Last reply
          0
          • A Amit Kumar G

            i fully agree with you. Why you need explicit call to GC. Can you share the reason. ? Amit

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            Amit Kumar G wrote:

            i fully agree with you. Why you need explicit call to GC. Can you share the reason. ?

            There may be a time when memory is critical and you need to clear it out but you cant wait on the GC to do it for you. These are rare cases along with any other cases where you would explicitly invoke the GC. I believe if you build your code to where you actually need to invoke the GC manually then you need to rethink your design.

            █▒▒▒▒▒██▒█▒██ █▒█████▒▒▒▒▒█ █▒██████▒█▒██ █▒█████▒▒▒▒▒█ █▒▒▒▒▒██▒█▒██

            1 Reply Last reply
            0
            • M miniThomas

              I am writing a program to collect values u fetch from System.GC.Collect () into DB Mini Thomas

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              miniThomas wrote:

              I am writing a program to collect values u fetch from System.GC.Collect

              :confused: GC.Collect does not return any values.

              █▒▒▒▒▒██▒█▒██ █▒█████▒▒▒▒▒█ █▒██████▒█▒██ █▒█████▒▒▒▒▒█ █▒▒▒▒▒██▒█▒██

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups