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

Transparent proxy + RealProxy memory footprint ?
JH2006
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
objArray
}
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)