login about faq

I have a question about your library. I’m using the http, httpResponse libraries for C (Linux 32 bit)

After a call to the method CkHttpResponse_bodyStr(), should I free the memory allocated for the returned string?

asked Aug 08 at 10:59

chilkat's gravatar image

chilkat ♦♦

The following rule applies for all Chilkat methods/properties across all classes (in C and C++).

Anything that returns a "const char *" is a pointer to internal memory that is owned by Chilkat and not guaranteed to remain valid. An application should use the string immediately. If the string needs to be saved, it should be copied to a buffer owned by the application. A "const char *" should not be deleted. (The "const" is an indicator that the caller does not own the memory.)

Any Chilkat method that returns a new Chilkat object (in C++) or a handle to an object (in C) must be deleted by the application. (Note: Chilkat never returns a "const" pointer to a Chilkat object, and Chilkat never returns a non-const pointer to a "char *". Therefore, objects are always deleted by the caller, but strings are not.)

In C++, you use the delete operator. In C, you pass the handle to the "Dispose" function. For example:



answered Aug 08 at 11:04

chilkat's gravatar image

chilkat ♦♦

edited Aug 08 at 11:05

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: Aug 08 at 10:59

Seen: 118 times

Last updated: Aug 08 at 11:05

powered by OSQA