Dotnet Ver5sion doesn't free unmanaged memory

RCFProto support and general discussion.
Post Reply
gstoessl
Posts: 3
Joined: Wed Aug 20, 2014 6:00 am

Dotnet Ver5sion doesn't free unmanaged memory

Post by gstoessl »

I am in the process of evaluating RCFProto für my company.
I managed to get a build with Studio 2005 and first results seemed quite good.

But during stress test of the C#-Server (repeatly requesting Arrays in large sizes) I realized, that no memory
was ever freed and after reaching 2 GByte, the client reveived only bad_ptr exceptions:

Code: Select all

 	RCFProto_NET.dll!DeltaVSoft.RCFProto.RcfProtoSession._SetResponseBuffer(byte[] szBuffer = {Dimensions:[200018]}, int szBufferLen = 200018) Line 61	C#
>	RCFProto_NET.dll!DeltaVSoft.RCFProto.RcfProtoServerImpl.ProtoRpcEndCs(DeltaVSoft.RCFProto.RcfProtoServer self = {DeltaVSoft.RCFProto.RcfProtoServer}, DeltaVSoft.RCFProto.RcfProtoSession session = {DeltaVSoft.RCFProto.RcfProtoSession}, Google.ProtocolBuffers.IMessage response) Line 432 + 0x13 bytes	C#
 	RCFProto_NET.dll!DeltaVSoft.RCFProto.RcfProtoServerImpl.ProtoRpcBegin.AnonymousMethod(Google.ProtocolBuffers.IMessage msg) Line 419 + 0x21 bytes	C#
 	Google.ProtocolBuffers.dll!Google.ProtocolBuffers.RpcUtil.SpecializeCallback<VarMessage>.AnonymousMethod(VarMessage message) Line 52 + 0x11 bytes	C#
 	RCFDOTNETServer.exe!RCFDOTNETServer.VariableServiceImpl.GetVars(Google.ProtocolBuffers.IRpcController controller = {DeltaVSoft.RCFProto.RcfProtoController}, QueryVars request = {numvars: 50000
}, System.Action<VarMessage> done = {System.Action<VarMessage>}) Line 27 + 0xe bytes	C#
 	RCFDOTNETServer.exe!VariableService.CallMethod(Google.ProtocolBuffers.Descriptors.MethodDescriptor method = {Google.ProtocolBuffers.Descriptors.MethodDescriptor}, Google.ProtocolBuffers.IRpcController controller = {DeltaVSoft.RCFProto.RcfProtoController}, Google.ProtocolBuffers.IMessage request = {numvars: 50000
}, System.Action<Google.ProtocolBuffers.IMessage> done = {System.Action<Google.ProtocolBuffers.IMessage>}) Line 1261 + 0x59 bytes	C#
 	RCFProto_NET.dll!DeltaVSoft.RCFProto.RcfProtoServerImpl.ProtoRpcBegin(DeltaVSoft.RCFProto.RcfProtoServer self = {DeltaVSoft.RCFProto.RcfProtoServer}, DeltaVSoft.RCFProto.RcfProtoSession session = {DeltaVSoft.RCFProto.RcfProtoSession}, string serviceName = "VariableService", int methodId = 0) Line 422 + 0x15 bytes	C#
 	RCFProto_NET.dll!DeltaVSoft.RCFProto.SwigCallback_ServerRpc.ProtoRpcBegin(DeltaVSoft.RCFProto._SwigCallbackArgs args = {DeltaVSoft.RCFProto._SwigCallbackArgs}, DeltaVSoft.RCFProto.RcfProtoServer self = {DeltaVSoft.RCFProto.RcfProtoServer}, DeltaVSoft.RCFProto.RcfProtoSession session = {DeltaVSoft.RCFProto.RcfProtoSession}, string serviceName = "VariableService", int methodId = 0) Line 362 + 0x1a bytes	C#
 	RCFProto_NET.dll!DeltaVSoft.RCFProto._SwigCallback.SwigDirectorProtoRpcBegin(System.IntPtr args = 114746540, System.IntPtr server = 13359480, System.IntPtr context = 2081889744, string serviceName = "VariableService", int methodId = 0) Line 86 + 0x170 bytes	C#
 	[Native to Managed Transition]	

Serviceimplementation:

Code: Select all

        public override void GetVars(
            Google.ProtocolBuffers.IRpcController controller,
            QueryVars request,
            System.Action<global::VarMessage> done)
        {
            VarMessage.Builder msgBuilder = VarMessage.CreateBuilder();
            {

                msgBuilder.SetSenderID(1)
                .SetTimeStamp((ulong)DateTime.Now.Ticks)
                .SetMessageID(1);
                int numvar = request.Numvars;
                for (int i = 0; i < numvar; i++)
                {
                    msgBuilder.AddData((float)(i / 0.2345));
                }
                VarMessage msg = msgBuilder.Build();
                done(msg);
            }
        }
The same Server in C++ doesn't show any Memoryproblems.

jarl
Posts: 238
Joined: Mon Oct 03, 2011 4:53 am
Contact:

Re: Dotnet Ver5sion doesn't free unmanaged memory

Post by jarl »

Thanks for reporting this. I've tracked it down to a leak in the non-C++ marshaling code.

We will get a new build out shortly.
Kind Regards

Jarl Lindrud
Delta V Software
http://www.deltavsoft.com

jarl
Posts: 238
Joined: Mon Oct 03, 2011 4:53 am
Contact:

Re: Dotnet Ver5sion doesn't free unmanaged memory

Post by jarl »

This issue is fixed in RCFProto 1.0.0.3 , which is now available for download.
Kind Regards

Jarl Lindrud
Delta V Software
http://www.deltavsoft.com

Post Reply