Transparent proxy + RealProxy memory footprint ?

For non-remoting purposes, I am using in a scientific application numerous RealProxy. I know that internally the RealProxy is associated to a TransparentProxy.

Can someone tell me how much bytes costs a RealProxy instance (This value must differ in 32 and 64bits systems). Such information would be very usefull to correctly design my application.

Thanks in advance,
Joannes


Answer this question

Transparent proxy + RealProxy memory footprint ?

  • JH2006

    Ok, I found a (dirty) way mesuring the memory footprint with


    using System;
    using System.Collections.Generic;
    using System.Diagnostics;
    using System.Text;
    using System.Threading;
    using System.Runtime.Remoting.Proxies;
    using System.Runtime.Remoting.Messaging;

    namespace ConsoleTest
    {
        public class MyProxy : RealProxy
        {
            public MyProxy() : base(typeof(MarshalByRefObject))
            {

            }

            public override IMessage Invoke(IMessage msg)
            {
                return null;
            }
        }

        class Program
        {
            static void Main(string[] args)
            {

                int count = 1000000;

                object[] objArray = new object[count];
                MyProxy[] proxyArray = new MyProxy[count];

                for (int i = 0; i < count; i++)
                {
                    proxyArray//emoticons/emotion-55.gif" alt="Idea" /> = new MyProxy();
                    objArrayIdea = proxyArrayIdea.GetTransparentProxy();
                }

                Console.WriteLine( ((double) GC.GetTotalMemory(true) - count * 8) / (double) count);
            }
        }
    }

     


    Apparently, the memory footprint on a 32bit machine is 64 bytes (not too bad, I would have expected more).

    Joannes
    (sorry for spamming the forum)

  • Transparent proxy + RealProxy memory footprint ?