diff options
| author | 0xTehuti <xtehuti@agentmail.to> | 2026-11-22 21:25:23 +0100 |
|---|---|---|
| committer | 0xTehuti <xtehuti@agentmail.to> | 2026-11-22 21:25:23 +0100 |
| commit | 77eb9cd726fa8d9f1151fa8b1d53e0f170545fdd (patch) | |
| tree | 4039d19fc1fe9d3954d12ee67d388b029dff3d0f /runtime/test/xmem_test.cpp | |
| parent | f847748cc76bd3777f9c070c4034eb2fc1c04e64 (diff) | |
xmem: write title memory limit at +0 in XMemGetWorkingSetStatistics (RT-220)
Diffstat (limited to 'runtime/test/xmem_test.cpp')
| -rw-r--r-- | runtime/test/xmem_test.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/runtime/test/xmem_test.cpp b/runtime/test/xmem_test.cpp index 7e4948f1f..d916b581b 100644 --- a/runtime/test/xmem_test.cpp +++ b/runtime/test/xmem_test.cpp | |||
| @@ -79,10 +79,17 @@ void test_working_set(XMemGetWorkingSetStatisticsFn get_stats) { | |||
| 79 | const BOOL ok = get_stats(kMeasuredKind, stats); | 79 | const BOOL ok = get_stats(kMeasuredKind, stats); |
| 80 | check(ok != FALSE, "XMemGetWorkingSetStatistics(kind, 64-byte out) returns TRUE"); | 80 | check(ok != FALSE, "XMemGetWorkingSetStatistics(kind, 64-byte out) returns TRUE"); |
| 81 | 81 | ||
| 82 | uint64_t total_memory = 0; | ||
| 83 | std::memcpy(&total_memory, stats + 0, sizeof(total_memory)); | ||
| 84 | check(ok != FALSE && total_memory != 0, "XMemGetWorkingSetStatistics writes a non-zero total memory at +0"); | ||
| 85 | |||
| 82 | uint64_t working_set = 0; | 86 | uint64_t working_set = 0; |
| 83 | std::memcpy(&working_set, stats + 8, sizeof(working_set)); | 87 | std::memcpy(&working_set, stats + 8, sizeof(working_set)); |
| 84 | check(ok != FALSE && working_set != 0, "XMemGetWorkingSetStatistics writes a non-zero size at +8"); | 88 | check(ok != FALSE && working_set != 0, "XMemGetWorkingSetStatistics writes a non-zero size at +8"); |
| 85 | 89 | ||
| 90 | check(ok != FALSE && total_memory >= working_set, | ||
| 91 | "XMemGetWorkingSetStatistics total memory (+0) >= working set (+8)"); | ||
| 92 | |||
| 86 | bool tail_untouched = true; | 93 | bool tail_untouched = true; |
| 87 | for (size_t i = 16; i < sizeof(stats); ++i) { | 94 | for (size_t i = 16; i < sizeof(stats); ++i) { |
| 88 | if (stats[i] != 0xa5) { | 95 | if (stats[i] != 0xa5) { |