# henrypp/memreduct architecture

> Architecture diagram of the GitHub repository henrypp/memreduct, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/henrypp/memreduct
- Repository: https://github.com/henrypp/memreduct

## Overview

Mem Reduct is a Windows desktop utility for monitoring memory use and reclaiming selected system memory. Users inspect usage in the main window or tray, then trigger cleanup manually or configure automatic cleanup based on usage and elapsed time. Cleanup targets include working sets, file caches, standby and modified lists, and newer Windows memory regions. A single substantial C source file contains the sampled application logic, so the graph separates its user interface, monitoring, cleanup, and settings responsibilities without implying separate modules. The README documents Native API cleanup; unsampled implementation details and framework wiring are omitted.

Main entry points: [`src/main.c`](https://github.com/henrypp/memreduct/blob/master/src/main.c) (Main window), [`bin/i18n`](https://github.com/henrypp/memreduct/tree/master/bin/i18n) (Locale resources)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["User interaction"]
  node_application["Application startup<br/>[main.c]"]
  node_mainui["Main window<br/>[main.c]"]
  node_tray["Tray controls<br/>[main.c]"]
  node_settingsui["Settings dialogs<br/>[main.c]"]
end

subgraph group_memory["Memory management"]
  node_monitor["Memory monitoring<br/>[main.c]"]
  node_autoclean["Auto-clean decisions<br/>[main.c]"]
  node_cleanup["Memory cleanup<br/>[main.c]"]
end

subgraph group_preferences["Configuration"]
  node_config["Runtime settings<br/>[main.c]"]
  node_locales["Locale resources"]
end

node_user(("User"))
node_windowsmemory["Windows memory system"]
node_framework["Application framework"]

node_user -->|"launches"| node_application
node_application -.->|"opens"| node_mainui
node_user -.->|"views"| node_mainui
node_user -.->|"controls"| node_tray
node_user -.->|"configures"| node_settingsui
node_monitor -->|"checks thresholds"| node_autoclean
node_autoclean -->|"triggers"| node_cleanup
node_monitor -->|"reads usage"| node_windowsmemory
node_cleanup -.->|"reclaims memory"| node_windowsmemory
node_mainui -.->|"displays usage"| node_monitor
node_mainui -.->|"requests cleanup"| node_cleanup
node_tray -.->|"requests cleanup"| node_cleanup
node_settingsui -->|"updates"| node_config
node_autoclean -->|"reads thresholds"| node_config
node_settingsui -.->|"uses translations"| node_locales
node_application -.->|"uses framework"| node_framework

click node_application "https://github.com/henrypp/memreduct/blob/master/src/main.c"
click node_mainui "https://github.com/henrypp/memreduct/blob/master/src/main.c"
click node_tray "https://github.com/henrypp/memreduct/blob/master/src/main.c"
click node_settingsui "https://github.com/henrypp/memreduct/blob/master/src/main.c"
click node_monitor "https://github.com/henrypp/memreduct/blob/master/src/main.c"
click node_autoclean "https://github.com/henrypp/memreduct/blob/master/src/main.c"
click node_cleanup "https://github.com/henrypp/memreduct/blob/master/src/main.c"
click node_config "https://github.com/henrypp/memreduct/blob/master/src/main.c"
click node_locales "https://github.com/henrypp/memreduct/tree/master/bin/i18n"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_application,node_mainui,node_tray,node_settingsui,node_user toneBlue
class node_monitor,node_autoclean,node_cleanup toneAmber
class node_config,node_locales toneMint
class node_windowsmemory,node_framework toneIndigo
```

## Components

### User interaction

- [Application startup](https://github.com/henrypp/memreduct/blob/master/src/main.c): `src/main.c`
- [Main window](https://github.com/henrypp/memreduct/blob/master/src/main.c): `src/main.c`
- [Tray controls](https://github.com/henrypp/memreduct/blob/master/src/main.c): `src/main.c`
- [Settings dialogs](https://github.com/henrypp/memreduct/blob/master/src/main.c): `src/main.c`

### Memory management

- [Memory monitoring](https://github.com/henrypp/memreduct/blob/master/src/main.c): `src/main.c`
- [Auto-clean decisions](https://github.com/henrypp/memreduct/blob/master/src/main.c): `src/main.c`
- [Memory cleanup](https://github.com/henrypp/memreduct/blob/master/src/main.c): `src/main.c`

### Configuration

- [Runtime settings](https://github.com/henrypp/memreduct/blob/master/src/main.c): `src/main.c`
- [Locale resources](https://github.com/henrypp/memreduct/tree/master/bin/i18n): `bin/i18n`

### Other components

- **User**
- **Windows memory system**
- **Application framework**

## Connections

- User → Application startup: launches (evidence: `README.md`)
- Application startup → Main window: opens (evidence: `src/main.c`)
- User → Main window: views
- User → Tray controls: controls
- User → Settings dialogs: configures
- Memory monitoring → Auto-clean decisions: checks thresholds (evidence: `src/main.c`)
- Auto-clean decisions → Memory cleanup: triggers (evidence: `src/main.c`)
- Memory monitoring → Windows memory system: reads usage (evidence: `src/main.c`)
- Memory cleanup → Windows memory system: reclaims memory (evidence: `README.md`)
- Main window → Memory monitoring: displays usage (evidence: `src/main.c`)
- Main window → Memory cleanup: requests cleanup (evidence: `src/main.c`)
- Tray controls → Memory cleanup: requests cleanup (evidence: `src/main.c`)
- Settings dialogs → Runtime settings: updates (evidence: `src/main.c`)
- Auto-clean decisions → Runtime settings: reads thresholds (evidence: `src/main.c`)
- Settings dialogs → Locale resources: uses translations
- Application startup → Application framework: uses framework
