Inside the companion
First Light
Make your first CPU image, rasterize triangles, and trace an allocation budget.
Project files 15
Print the memory evidence
Run the PMR experiment and report requests, retained values, and cleanup.
#include "prism/memory_lab.hpp"
#include <exception>
#include <iostream>
int main() {
try {
const auto report = prism::run_memory_lab();
std::cout << "Promoted owner: " << report.promoted_title
<< "\nSuccessful arena requests: " << report.allocations
<< "\nPeak requested bytes: " << report.peak_bytes
<< "\nLive requested bytes after scope: " << report.live_after_scope
<< "\nBounded failure preserved existing values: " << std::boolalpha << report.bounded_failure << '\n';
return report.bounded_failure && report.live_after_scope == 0 ? 0 : 1;
} catch (const std::exception&) {
std::cerr << "Memory experiment could not complete.\n";
return 1;
}
}
This is the file included with the course. Copy and download give you its complete source.
Taking your work offline? Download all course companions
