reduced memory usage, at the cost of performance

This commit is contained in:
Noah Laptop 2019-07-22 17:07:54 -07:00
parent 5d1c32d3c3
commit 0538c30081
4 changed files with 6 additions and 6 deletions

View file

@ -575,9 +575,9 @@ unsigned SSLClientImpl::m_update_engine() {
m_info(mem, func_name);
// free memory check
// BearSSL takes up so much memory on the stack it tends
// to overflow if there isn't at least 8000 bytes available
// to overflow if there isn't at least 7000 bytes available
// when it starts
if(mem < 8000) {
if(mem < 7000) {
m_error("Out of memory! Decrease the number of sessions or the size of m_iobuf", func_name);
setWriteError(SSL_OUT_OF_MEMORY);
stop_impl();

View file

@ -199,7 +199,7 @@ private:
* As a rule of thumb SSLClient will fail if it does not have at least 8000 bytes when starting a
* connection.
*/
unsigned char m_iobuf[BR_SSL_BUFSIZE_MONO / 8];
unsigned char m_iobuf[1536];
static_assert(sizeof m_iobuf <= BR_SSL_BUFSIZE_BIDI, "m_iobuf must be below maximum buffer size");
// store the index of where we are writing in the buffer
// so we can send our records all at once to prevent