aboutsummaryrefslogtreecommitdiffstats
path: root/libtests/qutil.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <jberkenbilt@users.noreply.github.com>2022-08-31 21:50:17 +0200
committerGitHub <noreply@github.com>2022-08-31 21:50:17 +0200
commita078202c1b5823f1c13a4c559619158054029e73 (patch)
treefd47549657238cc532768dd19b1eb9fffb5b0269 /libtests/qutil.cc
parent7b3134ef94db6ae1ca17c6d2dd4843322b7546c5 (diff)
parent4aac7c325acbf80ed4a6fc121c5a36f2d5515ff1 (diff)
downloadqpdf-a078202c1b5823f1c13a4c559619158054029e73.tar.zst
Merge pull request #752 from jberkenbilt/report-mem-usage
Report mem usage
Diffstat (limited to 'libtests/qutil.cc')
-rw-r--r--libtests/qutil.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/libtests/qutil.cc b/libtests/qutil.cc
index 995a7599..82c2dd1a 100644
--- a/libtests/qutil.cc
+++ b/libtests/qutil.cc
@@ -703,6 +703,18 @@ is_long_long_test()
std::cout << "done" << std::endl;
}
+void
+memory_usage_test()
+{
+ auto u1 = QUtil::get_max_memory_usage();
+ if (u1 > 0) {
+ auto x = QUtil::make_shared_array<int>(10 << 20);
+ auto u2 = QUtil::get_max_memory_usage();
+ assert(u2 > u1);
+ }
+ std::cout << "memory usage okay" << std::endl;
+}
+
int
main(int argc, char* argv[])
{
@@ -739,6 +751,8 @@ main(int argc, char* argv[])
timestamp_test();
std::cout << "---- is_long_long" << std::endl;
is_long_long_test();
+ std::cout << "---- memory usage" << std::endl;
+ memory_usage_test();
} catch (std::exception& e) {
std::cout << "unexpected exception: " << e.what() << std::endl;
}