Go to the documentation of this file.
53 if ((
ConfGet(
"app-layer.protocols.http.memcap", &conf_val)) == 1)
57 "from conf file - %s. Killing engine",
73 static void HTPIncrMemuse(uint64_t size)
79 static void HTPDecrMemuse(uint64_t size)
103 static int HTPCheckMemcap(uint64_t size)
106 if (memcapcopy == 0 || size +
SC_ATOMIC_GET(htp_memuse) <= memcapcopy)
119 if (size == 0 || (uint64_t)
SC_ATOMIC_GET(htp_memuse) < size) {
141 if (HTPCheckMemcap((uint32_t)size) == 0)
149 HTPIncrMemuse((uint64_t)size);
158 if (HTPCheckMemcap((uint32_t)(n * size)) == 0)
166 HTPIncrMemuse((uint64_t)(n * size));
173 if (size > orig_size) {
174 if (HTPCheckMemcap((uint32_t)(size - orig_size)) == 0)
182 if (size > orig_size) {
183 HTPIncrMemuse((uint64_t)(size - orig_size));
185 HTPDecrMemuse((uint64_t)(orig_size - size));
195 HTPDecrMemuse((uint64_t)size);
#define SC_ATOMIC_INIT(name)
wrapper for initializing an atomic variable.
#define SC_ATOMIC_SET(name, val)
Set the value for the atomic variable.
int ParseSizeStringU64(const char *size, uint64_t *res)
#define SC_ATOMIC_ADD(name, val)
add a value to our atomic variable
void * HTPRealloc(void *ptr, size_t orig_size, size_t size)
uint64_t HTPMemuseGlobalCounter(void)
SC_ATOMIC_DECLARE(uint64_t, htp_config_memcap)
int HTPSetMemcap(uint64_t size)
Update memcap value.
int ConfGet(const char *name, const char **vptr)
Retrieve the value of a configuration node.
uint64_t HTPGetMemcap(void)
Update memcap value.
void * HTPCalloc(size_t n, size_t size)
#define SC_ATOMIC_SUB(name, val)
sub a value from our atomic variable
#define SCLogInfo(...)
Macro used to log INFORMATIONAL messages.
#define SCRealloc(ptr, sz)
#define SCLogError(err_code,...)
Macro used to log ERROR messages.
uint64_t HTPMemcapGlobalCounter(void)
void * HTPMalloc(size_t size)
void HTPFree(void *ptr, size_t size)
#define SC_ATOMIC_GET(name)
Get the value from the atomic variable.