Visual C++ Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

C++ Examples

CkString
Byte Array
Bounced Mail
Bz2
Character Encoding
CSV
DH Key Exchange
DKIM/DomainKeys
Digital Certificates
Digital Signatures
DSA
Email
Email Object
Encryption
FTP
HTML Conversion
HTTP
IMAP
MHT / HTML Email
POP3
RSA
S/MIME
SMTP
Socket
Spider
SSH Key
SSH
SSH Tunnel
SFTP
Tar
Upload
XML
XMP
Zip Compression


More Examples...
Amazon S3
NTLM
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
Bzip2
LZW

 

 

 

 

 

 

 

 

Testing for Memory Leaks in the Zip Library

Downloads:

MS Windows Visual C/C++ Libraries
Linux/CentOS C/C++ Libraries
MAC OS X C/C++ Libraries
Solaris C/C++ Libraries
C++ Builder Libraries

Discusses the often-mistaken case of memory leaks in the Chilkat C++ library.

// The Chilkat C++ library creates some "stay-resident"
// structures on an as-needed basis that are not deallocated.  
// (They are deallocated from within CkSettings::cleanupMemory which can be
// called once at the end of your program.) 
// The stay-resident structures exist for performance reasons.  
// As an example, the CkZip class will initialize and
// keep huffman encoding tables in memory the first time it is called. 
 
// To check for memory leaks, make sure all Chilkat objects have been destructed
// and *then* call CkSettings::cleanupMemory.  One caveat: once CkSettings::cleanupMemory
// has been called, the program should *not* create any more Chilkat objects.
// Also, if you want to check for memory leaks, do not declare any Chilkat objects
// as global variables.  Global variables are destructed *after* the program's mainline
// has exited, so there is no way to call CkSettings::cleanupMemory after all Chilkat objects
// have been destructed.
void TestZip(void)
    {
    // Open a Zip and unzip it to the testDir subdirectory.
    CkZip zip;
    zip.UnlockComponent("Anything for 30-day trial");
    zip.OpenZip("test.zip");
    zip.Unzip("./testDir",0);
    zip.CloseZip();
    }

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
    // When TestZip returns, the Chilkat object(s) have been destructed, so we can
    // now call cleanupMemory.   
    TestZip();

    CkSettings::cleanupMemory();

    // At this point in the code, there should be no memory leaks...

    return 0;
}

 

 

 

© 2000-2010 Chilkat Software, Inc. All Rights Reserved.

Mail Component · .NET Mail Component · XML Parser