mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48:19 +00:00
Installing a handler for running out of memory in "new".
Bro will now print an error message in that case rather than abort with an uncaught exception.
This commit is contained in:
parent
4c3be63919
commit
4da209d3b1
4 changed files with 18 additions and 2 deletions
6
CHANGES
6
CHANGES
|
@ -1,4 +1,10 @@
|
||||||
|
|
||||||
|
2.1-beta-21 | 2012-08-16 11:48:56 -0700
|
||||||
|
|
||||||
|
* Installing a handler for running out of memory in "new". Bro will
|
||||||
|
now print an error message in that case rather than abort with an
|
||||||
|
uncaught exception. (Robin Sommer)
|
||||||
|
|
||||||
2.1-beta-20 | 2012-08-16 11:43:31 -0700
|
2.1-beta-20 | 2012-08-16 11:43:31 -0700
|
||||||
|
|
||||||
* Fixed potential problems with ElasticSearch output plugin. (Seth
|
* Fixed potential problems with ElasticSearch output plugin. (Seth
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
2.1-beta-20
|
2.1-beta-21
|
||||||
|
|
|
@ -337,6 +337,8 @@ void terminate_bro()
|
||||||
delete log_mgr;
|
delete log_mgr;
|
||||||
delete thread_mgr;
|
delete thread_mgr;
|
||||||
delete reporter;
|
delete reporter;
|
||||||
|
|
||||||
|
reporter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void termination_signal()
|
void termination_signal()
|
||||||
|
@ -380,6 +382,8 @@ static void bro_new_handler()
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
std::set_new_handler(bro_new_handler);
|
||||||
|
|
||||||
brofiler.ReadStats();
|
brofiler.ReadStats();
|
||||||
|
|
||||||
bro_argc = argc;
|
bro_argc = argc;
|
||||||
|
|
|
@ -1383,7 +1383,13 @@ void safe_close(int fd)
|
||||||
|
|
||||||
void out_of_memory(const char* where)
|
void out_of_memory(const char* where)
|
||||||
{
|
{
|
||||||
reporter->FatalError("out of memory in %s.\n", where);
|
fprintf(stderr, "out of memory in %s.\n", where);
|
||||||
|
|
||||||
|
if ( reporter )
|
||||||
|
// Guess that might fail here if memory is really tight ...
|
||||||
|
reporter->FatalError("out of memory in %s.\n", where);
|
||||||
|
|
||||||
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_memory_usage(unsigned int* total, unsigned int* malloced)
|
void get_memory_usage(unsigned int* total, unsigned int* malloced)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue