Theme Catppuccin
Make yourself at homeCatppuccin

A softer light for long learning sessions.

Appearance

Loading your preference…

Dark palette

Choose a dark palette to try it.

Light uses Latte. Your choices stay in this browser.

Back to your source shelf

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.

19 lines memory_main.cpp
#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