Click here to Skip to main content
14,385,119 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 17:44
memberSuper Lloyd14-May-19 17:44 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 17:48
memberhoney the codewitch14-May-19 17:48 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
Super Lloyd14-May-19 18:13
memberSuper Lloyd14-May-19 18:13 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 18:17
memberhoney the codewitch14-May-19 18:17 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 18:24
memberhoney the codewitch14-May-19 18:24 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
Super Lloyd14-May-19 18:30
memberSuper Lloyd14-May-19 18:30 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 18:38
memberhoney the codewitch14-May-19 18:38 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
Super Lloyd14-May-19 19:16
memberSuper Lloyd14-May-19 19: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.
    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 19:30
memberhoney the codewitch14-May-19 19:30 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 19:32
memberhoney the codewitch14-May-19 19:32 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
Super Lloyd14-May-19 19:40
memberSuper Lloyd14-May-19 19:40 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 19:43
memberhoney the codewitch14-May-19 19:43 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
Super Lloyd14-May-19 19:55
memberSuper Lloyd14-May-19 19:55 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 20:03
memberhoney the codewitch14-May-19 20:03 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
Super Lloyd14-May-19 20:11
memberSuper Lloyd14-May-19 20:11 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 20:32
memberhoney the codewitch14-May-19 20:32 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
Super Lloyd14-May-19 20:37
memberSuper Lloyd14-May-19 20:37 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 20:56
memberhoney the codewitch14-May-19 20:56 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
Super Lloyd14-May-19 21:32
memberSuper Lloyd14-May-19 21:32 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch15-May-19 4:38
memberhoney the codewitch15-May-19 4:38 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
Super Lloyd14-May-19 20:12
memberSuper Lloyd14-May-19 20:12 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 20:29
memberhoney the codewitch14-May-19 20:29 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
Super Lloyd14-May-19 20:40
memberSuper Lloyd14-May-19 20:40 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
johannesnestler15-May-19 5:09
memberjohannesnestler15-May-19 5:09 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch15-May-19 6:17
memberhoney the codewitch15-May-19 6: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.