Login  
Search All Forums
Dart Home | PowerTCP Mail for ActiveX | Custom Development Reply | PowerTCP Mail for ActiveX Topics | Forums   
AuthorForum: PowerTCP Mail for ActiveX
Topic: pop control is leaking
Adrian-Bogdan Andreias
sheic@softhome.net

From: Cluj-Napoca, Romania
Posts: 9
Member Since: 09/16/02
posted September 16, 2002 9:12 AM

Hi,

I am using VC++ 6.0. Yes, I've downloaded the latest dart update.

Using the attached code, the count of private bytes in performance monitor snap-in is increasing with aproximately 4KB, each time f() is called.
Is this a leak?
Am I doing something wrong?


#import <dartmail.dll> named_guids no_namespace
#include <iostream>
using namespace std;

int f();

int main()
{
for (int i = 0; i < 10; ++i)
f();

return 0;
}


int f()
{
CoInitialize(NULL);

{
IClassFactory2 *pFactory;

HRESULT hr = CoGetClassObject(CLSID_Pop,
CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER,
NULL, IID_IClassFactory2, (void **) &pFactory);
if (S_OK != hr)
{
cout << "Cann't get object" << endl;
return -1;
}

IUnknown *pUnk;

_bstr_t bstrLicence(POPTOOL_LICENSE);
hr = pFactory->CreateInstanceLic(NULL, NULL, IID_IPop, bstrLicence, (void **) &pUnk);

pFactory->Release();

if (S_OK != hr)
{
cout << "can't create instance of pop" << endl;
return -1;
}

IPop *pPop;
pUnk->QueryInterface(IID_IPop, (void **) &pPop);
pUnk->Release();

if (S_OK != hr)
{
cout << "can't get IPop" << endl;
return -1;
}

try
{
hr = pPop->Login(_bstr_t("192.168.100.1"), _bstr_t("test"), _bstr_t("asfsdsdfg"), 110);

pPop->Get(msgPreview, _bstr_t(""), NULL);
IMessage* spMsg = pPop->GetMessages()->Item(1);

_bstr_t b = spMsg->GetContent(msgMessage, msgString);

cout << (char *)b;

pPop->Logout();
pPop->Release();
}
catch(_com_error &er)
{
pPop->Release();
cout << (char *)er.Description();
}

}

CoUninitialize();

return 0;
}
Jon Belanger



From: Rome, NY USA
Posts: 310
Member Since: 06/10/02
posted September 16, 2002 9:36 AM

Hi,

  Correct usage of our Pop control in VC6 is documented in the example code we provide. I would suggest that you run our sample and see if you see the same memory problems. If you get different results, analyze our sample for any difference between it and your code. Hope that helps.
Adrian-Bogdan Andreias
sheic@softhome.net

From: Cluj-Napoca, Romania
Posts: 9
Member Since: 09/16/02
posted September 16, 2002 10:39 AM

You PopClient sample has 19 errors and 1 warning:

Deleting intermediate files and output files for project 'PopClient - Win32 Debug'.
--------------------Configuration: PopClient - Win32 Debug--------------------
Compiling resources...
Compiling...
StdAfx.cpp
Compiling...
AboutDlg.cpp
columnheader.cpp
columnheaders.cpp
DirectoryTree.cpp
DirList.cpp
DriveCombo.cpp
font.cpp
IPop.cpp
c:\program files\powertcp\mail tool\samples\vc6\pop\client\ipop.h(54) : error C2039: 'ErrorConstants' : is not a member of 'DartMail'
c:\program files\powertcp\mail tool\samples\vc6\pop\client\ipop.h(54) : error C2061: syntax error : identifier 'ErrorConstants'
C:\Program Files\PowerTCP\Mail Tool\Samples\Vc6\Pop\Client\IPop.cpp(154) : error C2039: 'ErrorConstants' : is not a member of 'DartMail'
C:\Program Files\PowerTCP\Mail Tool\Samples\Vc6\Pop\Client\IPop.cpp(154) : error C2065: 'ErrorConstants' : undeclared identifier
C:\Program Files\PowerTCP\Mail Tool\Samples\Vc6\Pop\Client\IPop.cpp(154) : error C2146: syntax error : missing ')' before identifier 'pDispParams'
C:\Program Files\PowerTCP\Mail Tool\Samples\Vc6\Pop\Client\IPop.cpp(154) : error C2059: syntax error : ')'
C:\Program Files\PowerTCP\Mail Tool\Samples\Vc6\Pop\Client\IPop.cpp(171) : error C2039: 'ErrorConstants' : is not a member of 'DartMail'
C:\Program Files\PowerTCP\Mail Tool\Samples\Vc6\Pop\Client\IPop.cpp(171) : error C2146: syntax error : missing ')' before identifier 'Number'
C:\Program Files\PowerTCP\Mail Tool\Samples\Vc6\Pop\Client\IPop.cpp(171) : warning C4229: anachronism used : modifiers on data are ignored
C:\Program Files\PowerTCP\Mail Tool\Samples\Vc6\Pop\Client\IPop.cpp(171) : error C2182: 'Pop_Error' : illegal use of type 'void'
C:\Program Files\PowerTCP\Mail Tool\Samples\Vc6\Pop\Client\IPop.cpp(171) : error C2350: 'IPop::Pop_Error' is not a static member
C:\Program Files\PowerTCP\Mail Tool\Samples\Vc6\Pop\Client\IPop.cpp(171) : error C2059: syntax error : ')'
C:\Program Files\PowerTCP\Mail Tool\Samples\Vc6\Pop\Client\IPop.cpp(172) : error C2143: syntax error : missing ';' before '{'
C:\Program Files\PowerTCP\Mail Tool\Samples\Vc6\Pop\Client\IPop.cpp(172) : error C2447: missing function header (old-style formal list?)
listitem.cpp
listitems.cpp
listsubitem.cpp
listsubitems.cpp
listview.cpp
MainFrm.cpp
Msg.cpp
c:\program files\powertcp\mail tool\samples\vc6\pop\client\ipop.h(54) : error C2039: 'ErrorConstants' : is not a member of 'DartMail'
c:\program files\powertcp\mail tool\samples\vc6\pop\client\ipop.h(54) : error C2061: syntax error : identifier 'ErrorConstants'
picture.cpp
PopClient.cpp
c:\program files\powertcp\mail tool\samples\vc6\pop\client\ipop.h(54) : error C2039: 'ErrorConstants' : is not a member of 'DartMail'
c:\program files\powertcp\mail tool\samples\vc6\pop\client\ipop.h(54) : error C2061: syntax error : identifier 'ErrorConstants'
PopClientDoc.cpp
PopClientView.cpp
c:\program files\powertcp\mail tool\samples\vc6\pop\client\ipop.h(54) : error C2039: 'ErrorConstants' : is not a member of 'DartMail'
c:\program files\powertcp\mail tool\samples\vc6\pop\client\ipop.h(54) : error C2061: syntax error : identifier 'ErrorConstants'
Server.cpp
Generating Code...
Error executing cl.exe.

PopClient.exe - 19 error(s), 1 warning(s)


I am using MS VC++ 6.0 SP 5.
Adrian-Bogdan Andreias
sheic@softhome.net

From: Cluj-Napoca, Romania
Posts: 9
Member Since: 09/16/02
posted September 16, 2002 10:47 AM

The samples were compiling ok before I've installed the update.
Funny update..
I found the problem, anyway.

Jon Belanger



From: Rome, NY USA
Posts: 310
Member Since: 06/10/02
posted September 16, 2002 11:01 AM

In the newest update we changed the name of the ErrorConstants to MailErrorConstants. You can get the updated sample if you download our newest kit.

Which problem did you solve?
Adrian-Bogdan Andreias
sheic@softhome.net

From: Cluj-Napoca, Romania
Posts: 9
Member Since: 09/16/02
posted September 19, 2002 3:40 AM

The one you just decribed.
I've replaced ErrorConstants with MailErrorConstants, now it compiles.
But there's an access viollation now in the POP sample..

Anyway, the main problem is: calling
pPop->Get(msgSize, "1", NULL) causes leaks.

These are tricky leaks because memory is not allocated on every method call . Bytes are allocated on every 5-6 method calls.
But these bytes are not deallocated when calling
pPop->Logout() or
pPop->Release().

I am sending you the VC++ test and the graph in MS Performence Monitor at support@dart.com.

Jon Belanger



From: Rome, NY USA
Posts: 310
Member Since: 06/10/02
posted September 19, 2002 10:20 AM

If you are getting an access violation in the edited sample you should probably download the new sample code. Here's a link.

http://www.dart.com/downloads/trialform.asp?thefile=MailTool.exe

See if you have memory problems when you run the sample.
Adrian-Bogdan Andreias
sheic@softhome.net

From: Cluj-Napoca, Romania
Posts: 9
Member Since: 09/16/02
posted September 20, 2002 9:01 AM

Yes, that's not that important.


Can you confirm/infirm the leak I am talking about?
Jon Belanger



From: Rome, NY USA
Posts: 310
Member Since: 06/10/02
posted September 20, 2002 9:10 AM

We haven't found any leaks in the POP control. My concern is that you aren't utilizing it properly. I want to see if you notice the same problem when running our POP sample.
Reply | PowerTCP Mail for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX