Memory leak referencing .net dll

My Virtual Memory gets about 8k higher every minute.

My Physical Memory about 4K every minute.

Is the problem in the external dll or in the c++ code?


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#include <iostream>
#include <string>

#import <c:\Atm\Dll\Payment.tlb> named_guids raw_interfaces_only


using namespace std;

int main()
{
	// Initialize
	CoInitialize(NULL);

	Payment::IPaymentAcsPtr pPaymentAcsPtr;

	HRESULT hres = pPaymentAcsPtr.CreateInstance(Payment::CLSID_PaymentAcs);


	// InitTerminal
	
		
	// Params

	
	FILE *hFile;
	int ret;
    hFile = fopen("C:\\atm\\logs\\transin.txt","w");

	ret = fprintf( hFile, "Amount to pay          : %i\n", 0);
	ret = fprintf(hFile, "Authorisation code EMV : %s\n", "");
	ret = fprintf(hFile, "Card Status            : %s\n", "1");
	ret = fprintf(hFile, "Card Type              : %s\n", "8");
	ret = fprintf(hFile, "Cashregister ID        : %s\n", "");
	ret = fprintf(hFile, "Command mode           : %s\n", "49152");
	ret = fprintf(hFile, "Currency Amount To Pay : %s\n", "1");
	ret = fprintf(hFile, "Inifile                : %s\n", "C:\\Atm\\Eft\\Eftcom.ini");
	ret = fprintf(hFile, "Operator ID            : %s\n", "");
	ret = fprintf(hFile, "Password               : %s\n", "");
	ret = fprintf(hFile, "Pin EMV                : %s\n", "");
	ret = fprintf(hFile, "Proton                 : %s\n", "1");
	ret = fprintf(hFile, "Reference              : %s\n", "");
	ret = fprintf(hFile, "Signature EMV          : %s\n", "");
	ret = fprintf(hFile, "Period TimeOut         : %i\n", 0);
	ret = fprintf(hFile, "Tip amount             : %i\n", 0);
	ret = fprintf(hFile, "Transaction ID         : %s\n", "");
	ret = fprintf(hFile, "Transaction Protocol   : %s\n", "");
	ret = fprintf(hFile, "IP Adress              : %s\n", "ping.banksys.be");
    fclose(hFile);

	

	pPaymentAcsPtr->InitTerminal();

	// Check Transuit.txt  

	// CheckCardBefore

	for (int i=1; i <= 50000; i = i +1)
	{
		pPaymentAcsPtr->CheckCardBefore();
		//Sleep(1000);
		cout << i << " ";
		
		
	}

	for (int i2=1; i2 <= 50000; i2 = i2 +1)
	{
		pPaymentAcsPtr->CheckCardBefore();
		//Sleep(1000);
		//cout << i2 << " ";
	}

	for (int i3=1; i3 <= 50000; i3 = i3 +1)
	{
		pPaymentAcsPtr->CheckCardBefore();
		//Sleep(1000);
		//cout << i3 << " ";
	}



Last edited on
Hello,

I have written the same code in c# and i seem to have any problems?

I use 'procexp.exe' to check the performance.

In the case of 'c++' the VM (Virtual Memory) and PM (Physical Memory) becomes larger every minute.

There is also an I/O block with a lot of parameters :-)

In c# only the parameter 'other' gets larger, the other parameters stay the same.

In c++ all the parameters change?!
Topic archived. No new replies allowed.