Go to the documentation of this file.
51 if ((
SCConfGet(
"app-layer.protocols.http.memcap", &conf_val)) == 1) {
54 "from conf file - %s. Killing engine",
70 static void HTPIncrMemuse(uint64_t size)
75 static void HTPDecrMemuse(uint64_t size)
98 static int HTPCheckMemcap(uint64_t size)
101 if (memcapcopy == 0 || size +
SC_ATOMIC_GET(htp_memuse) <= memcapcopy)
114 if (size == 0 || (uint64_t)
SC_ATOMIC_GET(htp_memuse) < size) {
136 if (HTPCheckMemcap((uint32_t)size) == 0) {
148 HTPIncrMemuse((uint64_t)size);
157 if (HTPCheckMemcap((uint32_t)(n * size)) == 0) {
169 HTPIncrMemuse((uint64_t)(n * size));
176 if (size > orig_size) {
177 if (HTPCheckMemcap((uint32_t)(size - orig_size)) == 0) {
189 if (size > orig_size) {
190 HTPIncrMemuse((uint64_t)(size - orig_size));
192 HTPDecrMemuse((uint64_t)(orig_size - size));
202 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
int SCConfGet(const char *name, const char **vptr)
Retrieve the value of a configuration node.
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.
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.