Allocate shared buffer and its data in one chunk
The GWBUF shared buffer and its data is now allocated in one chunk so that the data directly follows the shared buffer. That way, creating a GWBUF will involve 2 and not 3 calls to malloc and freeing one will involve 2 and not 3 calls to free.
This commit is contained in:
@ -105,10 +105,10 @@ struct buffer_object_st
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
unsigned char *data; /*< Physical memory that was allocated */
|
||||
int refcount; /*< Reference count on the buffer */
|
||||
int32_t refcount; /*< Reference count on the buffer */
|
||||
buffer_object_t *bufobj; /*< List of objects referred to by GWBUF */
|
||||
uint32_t info; /*< Info bits */
|
||||
unsigned char data[1]; /*< Actual memory that was allocated */
|
||||
} SHARED_BUF;
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user