1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-14 10:13:05 +02:00

Rearrange members in StackTraceData struct to save memory.

This arrangement is more efficient on 64-bit systems due to alignment. There is no difference on 32-bit systems.
This commit is contained in:
David Steele 2020-08-20 15:53:01 -04:00
parent 859b8a50fd
commit 25ee913932
2 changed files with 6 additions and 2 deletions

View File

@ -34,10 +34,10 @@ typedef struct StackTraceData
LogLevel functionLogLevel;
unsigned int tryDepth;
char *param;
size_t paramSize;
bool paramOverflow;
bool paramLog;
char *param;
size_t paramSize;
} StackTraceData;
static StackTraceData stackTrace[STACK_TRACE_MAX];

View File

@ -68,6 +68,10 @@ testRun(void)
#ifdef WITH_BACKTRACE
stackTraceInit(testExe());
#endif
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("check size of StackTraceData");
TEST_RESULT_UINT(sizeof(StackTraceData), TEST_64BIT() ? 48 : 32, "check");
TEST_ERROR(stackTracePop("file1", "function1", false), AssertError, "assertion 'stackSize > 0' failed");