Go to the documentation of this file.
51 if ((
ConfGet(
"app-layer.protocols.http.memcap", &conf_val)) == 1)
55 "from conf file - %s. Killing engine",
71 static void HTPIncrMemuse(uint64_t size)
76 static void HTPDecrMemuse(uint64_t size)
99 static int HTPCheckMemcap(uint64_t size)
102 if (memcapcopy == 0 || size +
SC_ATOMIC_GET(htp_memuse) <= memcapcopy)
115 if (size == 0 || (uint64_t)
SC_ATOMIC_GET(htp_memuse) < size) {
137 if (HTPCheckMemcap((uint32_t)size) == 0) {
149 HTPIncrMemuse((uint64_t)size);
158 if (HTPCheckMemcap((uint32_t)(n * size)) == 0) {
170 HTPIncrMemuse((uint64_t)(n * size));
177 if (size > orig_size) {
178 if (HTPCheckMemcap((uint32_t)(size - orig_size)) == 0) {
190 if (size > orig_size) {
191 HTPIncrMemuse((uint64_t)(size - orig_size));
193 HTPDecrMemuse((uint64_t)(orig_size - size));
203 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)
void HTPParseMemcap(void)
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(...)
Macro used to log ERROR messages.
uint64_t HTPMemcapGlobalCounter(void)
thread_local SCError sc_errno
void * HTPMalloc(size_t size)
void HTPFree(void *ptr, size_t size)
#define SC_ATOMIC_GET(name)
Get the value from the atomic variable.