cancel
Showing results for 
Search instead for 
Did you mean: 

.NET Connector Memory Allocation

Former Member
0 Kudos

Hi.

we're calling a abap program via RFC. We'are using .NET Connector 2.0.1 and SAPGUI 6.40 PL 15.

we're using the following Code :

SAP.Connector.Connection conn = SAP.Connector.Connection.GetConnection(this.Destination_SAP);

this.sapProxy11.Connection = conn;

this.sapProxy11.Z_Rfc_Sapgui_Close("400",mySAPLogon.sapuser);

this.sapProxy11.Connection.Close();

this.sapProxy11.Connection = null;

But when the rfc function is executed, the program allocated approx. 10MB of memory.

In ABAP we're using the following code:

FUNCTION Z_RFC_SAPGUI_CLOSE.

*"----


""Lokale Schnittstelle:

*" IMPORTING

*" VALUE(L_USERNAME) TYPE SY-UNAME

*" VALUE(L_CLIENT) TYPE SY-MANDT

*"----


CALL FUNCTION 'TH_DELETE_USER'

EXPORTING

user = l_username

client = l_client

  • ONLY_POOLED_USER = ' '

  • TID = -1

  • EXCEPTIONS

  • AUTHORITY_ERROR = 1

  • OTHERS = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFUNCTION.

When i call the function twice, then memory allocation is growing every time by 10 MB.

Do you have any Ideas ? I dont't have any ideas, why this happens.

Thanks a lot!!!

Sebastian

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

I got a perfmon memory usage graph with the following test program:

static void Main(string[] args)

{

SAPLogonDestination dest =

new SAPLogonDestination("XXXXX");

dest.Username = "hello";

dest.Client = 0;

dest.Password = "world";

SAPProxy1 prxy = new SAPProxy1();

for(int i = 0; i < 3000; i ++)

{

Connection conn = Connection.GetConnection(dest);

prxy.Connection = conn;

try

{

prxy.Th_Delete_User("000", " ",-1,"hello");

}

catch(Exception ex)

{

Console.WriteLine(ex.Message);

}

finally

{

prxy.Connection.Dispose();

}

Thread.Sleep(10);

}

Console.ReadLine();

}

The picture shows that the memory usage remains almost contant after an increase phase at the begining:

23.7 MB


--

--|

-


Regards,

Guangwei Li

Former Member
0 Kudos

Sorry, the picture looks not so good, but you got the idea. Right?

Guangwei Li

Former Member
0 Kudos

Hi Guangwei,

i have more or less the same problem. I developed an RFC Server as Windows service. This RFC Servers offers approx. 200 methods. The memory usage grows and grows for each call to the server. I produced a memory profile of the service and found out that the service has a lot of instances of strings, which consumes more or less most of the memory. The instances belongs to the namespace sap.connector.rfc mostly in the xmlserializers. It seems the connector keeps some trash after serialalization. Do you have an idea how to clean up the heap from those strings?

here some hints where the big strings are kept:

System.Collections Hashtable.bucket[]

System.Collections Hashtable

SAP.Connector SAPServer _methodRfcAttributes

also a lot of memory is consumed in bytes arrays.

best regards,

Kai