none
disable Garbage Collection RRS feed

  • Question

  • Plz make me suggestion:

    I want to implement logic to garbage collector using c#.net. i.e. want to code to do GC in my own logic. So my Questions are:

    1. Where should i write code to do it?

    2. If it is c#.Net. how do i disable or restrict .Net Framework to auto collect garbage?

     

    Please advice me for above question.

    Friday, May 13, 2011 6:49 PM

Answers

  • That enables/disables concurrency in the garbage collector but does not disable it completly. As far as i know there are no extention points for a custom garbage collector.  If you are just interested in tinkering and make your own GC you could replace the one that ships in the Shared Source CLI but i'd only go that way if it was a research project, cause there's no way you can ship your modifications to end users that have the 'normal' runtime.

    • Marked as answer by Neo Ashu Monday, May 16, 2011 5:24 PM
    Friday, May 13, 2011 8:53 PM

All replies

  • I search on google and found following code (but it is not working) :(

     

     

    <configuration>
     <runtime>
      <gcConcurrent enabled="false"/>
     </runtime>
    </configuration>
    Friday, May 13, 2011 6:54 PM
  • That enables/disables concurrency in the garbage collector but does not disable it completly. As far as i know there are no extention points for a custom garbage collector.  If you are just interested in tinkering and make your own GC you could replace the one that ships in the Shared Source CLI but i'd only go that way if it was a research project, cause there's no way you can ship your modifications to end users that have the 'normal' runtime.

    • Marked as answer by Neo Ashu Monday, May 16, 2011 5:24 PM
    Friday, May 13, 2011 8:53 PM
  • Which does raise the question, of course...why do you want to do this? What are you trying to accomplish by manually handling garbage collection? There are ways to make sure a full GC doesn't occur while you're doing some batch process or something, or to prevent finalize being called on a particular object for a time, but I can't imagine any situation where it would be beneficial to disable it completely...
    Friday, May 13, 2011 9:23 PM
  • It is just for a little research task that i want to implement.

    Although i have theoretical knowledge of GC but cant see actual implementation, I want to see behavior of GC. and then implement my own.

    Thanks for consideration!

    Monday, May 16, 2011 5:18 PM
  • Thanks Ray,

    I only want to research on GC.  Your answer seems helpful to me.

    I am going to check shared source CLI.  :)

    Thanks for consideration!

    Monday, May 16, 2011 5:22 PM
  • Great Dude It is really helpful to me.

    Thank you very much.

    Monday, May 16, 2011 5:24 PM
  • That enables/disables concurrency in the garbage collector but does not disable it completly. As far as i know there are no extention points for a custom garbage collector.  If you are just interested in tinkering and make your own GC you could replace the one that ships in the Shared Source CLI but i'd only go that way if it was a research project, cause there's no way you can ship your modifications to end users that have the 'normal' runtime.

    Great Dude It is really helpful to me.
    Monday, May 16, 2011 5:24 PM
  • :(

    when I run env.bat on windows XP sp2, i got following error.

    *** Error *** 
    MSVCDir not defined. VC++ environment variables must be set before 
    executing.)

    Tuesday, May 17, 2011 4:08 PM