From 682730fbe4aaae524c5725b933fbb7dd56932b2b Mon Sep 17 00:00:00 2001 From: Laurens Voerman Date: Tue, 22 Aug 2017 15:23:47 +0200 Subject: [PATCH] reduce the need to reallocate the std::ostream buffer behind osg::Notify (causing multitreading issues) by pre-allocating 4095 bytes. --- src/osg/Notify.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/osg/Notify.cpp b/src/osg/Notify.cpp index 02d1f8527..e562aea4d 100644 --- a/src/osg/Notify.cpp +++ b/src/osg/Notify.cpp @@ -61,6 +61,9 @@ struct NotifyStreamBuffer : public std::stringbuf { NotifyStreamBuffer() : _severity(osg::NOTICE) { + /* reduce the need to reallocate the std::ostream buffer behind osg::Notify (causing multitreading issues) by pre-allocating 4095 bytes */ + str(std::string(4095, 0)); + pubseekpos(0, std::ios_base::out); } void setNotifyHandler(osg::NotifyHandler *handler) { _handler = handler; }