add func sf_enable_exit_on_oom
parent
43351fc67b
commit
8b11d63ac6
|
|
@ -41,3 +41,16 @@ int sf_connect_to_server(const char *ip_addr, const int port, int *sock)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void sf_memory_oom_notify_callback(const size_t curr_size)
|
||||
{
|
||||
logCrit("file: "__FILE__", line: %d, "
|
||||
"alloc %"PRId64" bytes fail, exiting ...",
|
||||
__LINE__, (int64_t)curr_size);
|
||||
SF_G_CONTINUE_FLAG = false;
|
||||
}
|
||||
|
||||
void sf_enable_exit_on_oom()
|
||||
{
|
||||
g_oom_notify = sf_memory_oom_notify_callback;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ extern "C" {
|
|||
|
||||
int sf_connect_to_server(const char *ip_addr, const int port, int *sock);
|
||||
|
||||
void sf_enable_exit_on_oom();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue