J
Jon Harrop
If you do metaprogramming in C#, is the generated code garbage collected or
does it leak indefinitely?
does it leak indefinitely?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Jon said:If you do metaprogramming in C#, is the generated code garbage collected
or does it leak indefinitely?
If you do metaprogramming in C#, is the generated code garbage collected
or does it leak indefinitely?
Without providing more detail, I find it difficult to be sure what you're
really trying to do.

Harrop's usual purpose on this group![]()
Interstingly, I think it is a valid discussion - but the important
context is: "at what?". Functional languages do have advantages,
especially in areas such as science / modelling - however, it isn't
necessarily a great fit for the typical business application.
Absolutely.
It is *certainly* a much more meaningful discussion than the far-too-
regular VB vs C# ;-p
Jon Skeet said:True. I just wish Jon would get into it properly rather than just
asking leading questions: "If you do X does C# behave badly", "Is C#
going to give way to F#" etc.
Jon
Jon said:True. I just wish Jon would get into it properly rather than just
asking leading questions: "If you do X does C# behave badly", "Is C#
going to give way to F#" etc.

Ben said:Without providing more detail, I find it difficult to be sure what you're
really trying to do.
If you dynamically create and load assemblies, you should probably load
them into a new appdomain. You cannot unload an assembly, but you can
discard an appdomain and discarding the appdomain will discard all the
assemblies loaded into it with it.
One final question: is code deallocation safe? So, if function A in assembly
A' calls function B in assembly B' and you deallocate the appdomain
containing B' before calling A, do you get a nice exception or a nasty
access violation?
Jon said:You'll get an AppDomainUnloadException.
Jon Harrop said:Ok.
Can you garbage collect generated code by putting it in an app domain and
wrapping the app domain in a class that uses a finalizer to explicitly
deallocate the app domain?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.