From 7bc730ab73f5771939e9b31c42bb25c2a73697cc Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 20 Sep 2017 21:25:00 +0200 Subject: [PATCH] Use pool of buffers in TimeToString(). --- server/TracyView.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index b05e7bc7..e7e45562 100755 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -337,7 +337,12 @@ uint64_t View::GetLastTime() const const char* View::TimeToString( uint64_t ns ) const { - static char buf[64]; + enum { Pool = 4 }; + static char bufpool[Pool][64]; + static int bufsel = 0; + char* buf = bufpool[bufsel]; + bufsel = ( bufsel + 1 ) % Pool; + if( ns < 1000 ) { sprintf( buf, "%i ns", ns );