login about faq

I have a question regarding the usage of the C Libraries:

In which cases do I have to explicitly dispose a Chilkat object? My current example are the ZIP Libs, but the basic question matters for the whole library:

CkZipEntry_Dispose states:

Objects created by calling CkZipEntry_Create must be freed by calling this method.

How is this to be treated with objects handles returned by the API itself, for example with CkZip_FirstEntry?

I assume that I get some reference to an existing object within the ZIP Object in question. So on one hand I assume, that I must not dispose it. This would be in accordance with the documentation, since I did not explicitly create the data structure in question.

However, I believe that I am experiencing a memory leak at exactly that call, which vanishes if I add a CkZipEntry_Dispose after getting and using the FirstEntry handle.

asked Apr 29 '13 at 08:44

chilkat's gravatar image

chilkat ♦♦

Any object handle returned by a Chilkat "C" function must also be explicitly freed by the application by calling the appropriate "_Dispose" function.

For example:

    //  Get the number of files and directories in the .zip
    n = CkZip_getNumEntries(zip);

for (i = 0; i <= n - 1; i++) {

    entry = CkZip_GetEntryByIndex(zip,i);
    if (CkZipEntry_getIsDirectory(entry) == FALSE) {


answered Apr 29 '13 at 08:46

chilkat's gravatar image

chilkat ♦♦

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Apr 29 '13 at 08:44

Seen: 2,329 times

Last updated: Apr 29 '13 at 08:46

powered by OSQA