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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. How to release memory in c#

How to release memory in c#

Scheduled Pinned Locked Moved C#
questioncsharpperformancetutorialannouncement
5 Posts 4 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.
  • B Offline
    B Offline
    BicycleTheif
    wrote on last edited by
    #1

    How can i release memory allocated by new operator by myself?is there any keyword available to do it? Thanks Nithya..

    M 1 Reply Last reply
    0
    • B BicycleTheif

      How can i release memory allocated by new operator by myself?is there any keyword available to do it? Thanks Nithya..

      M Offline
      M Offline
      mav northwind
      wrote on last edited by
      #2

      No, there isn't. Memory is released after it's no longer needed, i.e. every reference to an object instance has been removed, nothing you can do about it. Btw. why would you want to handle memory allocation yourself? mav

      B 1 Reply Last reply
      0
      • M mav northwind

        No, there isn't. Memory is released after it's no longer needed, i.e. every reference to an object instance has been removed, nothing you can do about it. Btw. why would you want to handle memory allocation yourself? mav

        B Offline
        B Offline
        BicycleTheif
        wrote on last edited by
        #3

        Thanks for the reply.i am allocating memory inside a loop so i tried to release it when i dont want.. Thanks Nithya..

        S M 2 Replies Last reply
        0
        • B BicycleTheif

          Thanks for the reply.i am allocating memory inside a loop so i tried to release it when i dont want.. Thanks Nithya..

          S Offline
          S Offline
          S Senthil Kumar
          wrote on last edited by
          #4

          You don't need to do anything, when the object has no live references to it, the GC (Garbage Collector) will automatically clean it up. Regards Senthil _____________________________ My Blog | My Articles | WinMacro

          1 Reply Last reply
          0
          • B BicycleTheif

            Thanks for the reply.i am allocating memory inside a loop so i tried to release it when i dont want.. Thanks Nithya..

            M Offline
            M Offline
            Matt Gerrans
            wrote on last edited by
            #5

            Let's see the code. Then the replies can be more to the point. On Disposable objects you can use the [b]using[/b] keyword. Are you trying to solve a real problem (performance, memory?), or is this just latent anal-retentiveness of a recovering c/c++ programmer? ;) Matt Gerrans

            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