-
Notifications
You must be signed in to change notification settings - Fork 0
MemoryManagement
Renaud Guillard edited this page Aug 14, 2022
·
1 revision
By default, httpmessage library does not allocates any memory to store text chunks. It only creates descriptor structures that point to text memory block allocated elsewhere.
/* Declare and initialize members */
struct httpmessage_request descriptor;
httpmessage_request_init(&descriptor);
/* ... processing ... */
/* Free memory allocated durring processing */
httpmessage_request_clear (&descriptor, 0);
struct httpmessage_request *descriptor = httpmessage_request_new();
/* ... processing ... */
httpmessage_request_free (descriptor);
struct httpmessage_request *storage = httpmessage_request_storage_new(8, 2);
int option_flags = HTTPMESSAGE_CLEAR_NO_FREE | HTTPMESSAGE_NO_ALLOCATION;
/* ... processing ...
httpmessage_request_consume(descriptor, ..., option_flags);
*/
free (descriptor);