2013-12-01 20:42:32 +00:00
|
|
|
/*
|
|
|
|
Copyright (c) 2013 Microsoft Corporation. All rights reserved.
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
|
|
|
|
Author: Leonardo de Moura
|
|
|
|
*/
|
|
|
|
#pragma once
|
2013-12-09 22:56:48 +00:00
|
|
|
#include <cstdlib>
|
|
|
|
|
2013-12-01 20:42:32 +00:00
|
|
|
namespace lean {
|
2013-12-10 06:30:54 +00:00
|
|
|
#if defined(LEAN_USE_SPLIT_STACK)
|
|
|
|
// If we are using split stacks, we don't need to check anything
|
|
|
|
inline void check_stack(char const * ) { }
|
|
|
|
inline size_t get_stack_size(bool ) { return 8192*1024; }
|
|
|
|
inline void save_stack_info(bool = true) {}
|
|
|
|
inline size_t get_used_stack_size() { return 0; }
|
|
|
|
inline size_t get_available_stack_size() { return 8192*1024; }
|
|
|
|
#else
|
2013-12-04 16:56:41 +00:00
|
|
|
size_t get_stack_size(bool main);
|
|
|
|
void save_stack_info(bool main = true);
|
2013-12-01 20:42:32 +00:00
|
|
|
size_t get_used_stack_size();
|
|
|
|
size_t get_available_stack_size();
|
|
|
|
/**
|
|
|
|
\brief Throw an exception if the amount of available stack space is low.
|
2013-12-07 22:59:21 +00:00
|
|
|
|
|
|
|
\remark The optional argument \c component_name is used to inform the
|
|
|
|
user which module is the potential offender.
|
2013-12-01 20:42:32 +00:00
|
|
|
*/
|
2013-12-07 22:59:21 +00:00
|
|
|
void check_stack(char const * component_name);
|
2013-12-10 06:30:54 +00:00
|
|
|
#endif
|
2013-12-01 20:42:32 +00:00
|
|
|
}
|