Click here to Skip to main content
15,900,725 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
Super Lloyd14-May-19 16:44
Super Lloyd14-May-19 16:44 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 16:48
mvahoney the codewitch14-May-19 16:48 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
Super Lloyd14-May-19 17:13
Super Lloyd14-May-19 17:13 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 17:17
mvahoney the codewitch14-May-19 17:17 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 17:24
mvahoney the codewitch14-May-19 17:24 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
Super Lloyd14-May-19 17:30
Super Lloyd14-May-19 17:30 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 17:38
mvahoney the codewitch14-May-19 17:38 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
Super Lloyd14-May-19 18:16
Super Lloyd14-May-19 18:16 
this is going nowhere so I will stop trying to convince to write proper utility classes.

although I will just add 2 (last) things:
  • for the record memory management, and even dispose, is indeed totally useless if all you have is short running processes. the issue is all about singular long running process running as long as possible. which you seem to dismiss so casually for some mysterious reason
  • you were asking for a sample that show if finalizer are even ever called. well run the winform app below as a console app (to see the Console.WriteLine() output), press the button a few times, tab out and in, do it again. you will see that finalizer are indeed called sometimes.
C#
    class Program
    {
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MyForm());
        }
    }
    public class MyForm : Form
    {
        public MyForm()
        {
            var b = new Button
            {
                Text = "Click",
                Dock = System.Windows.Forms.DockStyle.Fill,
            };
            b.Click += (o, e) => { new Foo(); };
            this.Controls.Add(b);
        }
    }
    public class Foo
    {
        const int N = 100_000;

<pre>
    IntPtr unmanaged;
    public Foo()
    {
        unmanaged = Marshal.AllocHGlobal(N);
        GC.AddMemoryPressure(N);
    }
    ~Foo()
    {
        Console.WriteLine("in finalizer");
        // not freeing any memory on purpose
        //Marshal.FreeHGlobal(unmanaged);
        //GC.RemoveMemoryPressure(N);
    }
}</pre>
A new .NET Serializer
All in one Menu-Ribbon Bar
Taking over the world since 1371!


modified 15-May-19 0:23am.

GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 18:30
mvahoney the codewitch14-May-19 18:30 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 18:32
mvahoney the codewitch14-May-19 18:32 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
Super Lloyd14-May-19 18:40
Super Lloyd14-May-19 18:40 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 18:43
mvahoney the codewitch14-May-19 18:43 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
Super Lloyd14-May-19 18:55
Super Lloyd14-May-19 18:55 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 19:03
mvahoney the codewitch14-May-19 19:03 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
Super Lloyd14-May-19 19:11
Super Lloyd14-May-19 19:11 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 19:32
mvahoney the codewitch14-May-19 19:32 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
Super Lloyd14-May-19 19:37
Super Lloyd14-May-19 19:37 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 19:56
mvahoney the codewitch14-May-19 19:56 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
Super Lloyd14-May-19 20:32
Super Lloyd14-May-19 20:32 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch15-May-19 3:38
mvahoney the codewitch15-May-19 3:38 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
Super Lloyd14-May-19 19:12
Super Lloyd14-May-19 19:12 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 19:29
mvahoney the codewitch14-May-19 19:29 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
Super Lloyd14-May-19 19:40
Super Lloyd14-May-19 19:40 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
johannesnestler15-May-19 4:09
johannesnestler15-May-19 4:09 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch15-May-19 5:17
mvahoney the codewitch15-May-19 5:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Straw Poll

Were you affected by the geomagnetic storms this past weekend?
Communication disruptions, electrified pipes, random unexplained blue-screens in Windows - the list of effects is terrifying.
  Results   494 votes