diff options
author | Jay Berkenbilt <ejb@ql.org> | 2022-08-31 19:51:58 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2022-08-31 20:47:27 +0200 |
commit | 433f1dae19b63f263af8a3d3cc9b3e328171d9ca (patch) | |
tree | 9bc0acba67142ac3d5cc6d42b54c64c527e7d3c2 /libqpdf/QPDFJob.cc | |
parent | 0a54247652e49ce384dcf0d8df078201aa106089 (diff) | |
download | qpdf-433f1dae19b63f263af8a3d3cc9b3e328171d9ca.tar.zst |
Add --report-mem-usage option for debugging/testing
Diffstat (limited to 'libqpdf/QPDFJob.cc')
-rw-r--r-- | libqpdf/QPDFJob.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libqpdf/QPDFJob.cc b/libqpdf/QPDFJob.cc index 15a81854..7bd563aa 100644 --- a/libqpdf/QPDFJob.cc +++ b/libqpdf/QPDFJob.cc @@ -417,7 +417,8 @@ QPDFJob::Members::Members() : check_is_encrypted(false), check_requires_password(false), json_input(false), - json_output(false) + json_output(false), + report_mem_usage(false) { } @@ -625,6 +626,14 @@ QPDFJob::run() << ": operation succeeded with warnings\n"; } } + if (m->report_mem_usage) { + // Call get_max_memory_usage before generating output. When + // debugging, it's easier if print statements from + // get_max_memory_usage are not interleaved with the output. + auto mem_usage = QUtil::get_max_memory_usage(); + *this->m->log->getWarn() + << "qpdf-max-memory-usage " << mem_usage << "\n"; + } } bool |