[Snort-users] Stream4 and other stuff
cpw at ...440...
Fri Jun 29 14:04:59 EDT 2001
Looking at stream4 from a memory allocation and deallocation standpoint.
In SaveAlloc, the first thing that is done is a calloc, then a check
for memory usage exceeded, then finally a check for the calloc failure.
Would it be better to drop the calloc down to just before the failure
void *SafeAlloc(unsigned long size)
stream4_memory_usage += size;
/* if we use up all of our RAM, try to free up some stale sessions */
if(stream4_memory_usage > s4data.memcap)
struct timeval tv;
struct timezone tz;
/* if we can't prune due to time, just nuke 5 random sessions */
***to here: tmp = (void *) calloc(size, sizeof(char));
if(tmp == NULL)
FatalError("Unable to allocate memory! (%lu bytes in use)\n",
Phil Wood, cpw at ...440...
More information about the Snort-users