A visual playground for understanding the internals of the stack and heap in Java applications. Create interactive diagrams to visualize objects, references, variables, and method calls.
Visit jmp.openpatch.org to start using the Java Memory Playground in your browser.
- Visual Memory Modeling: Create and visualize Java objects, variables, and method calls
- Stack and Heap Visualization: See how the stack (method calls and local variables) and heap (objects) interact
- References: Connect variables to objects with visual reference arrows
- Class Definitions: Define custom classes with attributes
- Garbage Collection: Simulate garbage collection to see which objects would be removed
When you click the "Save (URL)" button, your current project state is saved directly to the URL. This means:
- Persistence: The URL contains all your work - no account needed
- Sharing: Copy and share the URL with others to share your memory diagram
- Reloading: Bookmark or save the URL to return to your project later
The URL uses compressed encoding to efficiently store your entire project state in the browser's address bar.
For educators, the Java Memory Playground is perfect for teaching memory concepts:
- Prepare: Create a memory diagram showing a specific concept (linked lists, object references, method call stack, etc.)
- Save: Click "Save (URL)" to encode your diagram in the URL
- Share: Copy the URL and share it with your students via email, LMS, or messaging
- Learn: Students can open the URL to see your exact diagram, explore it, and modify it for learning
No setup or installation required for students - they just open the link and start learning!
- Node.js (v14 or higher)
- npm
Clone the repository and install dependencies:
git clone https://github.com/openpatch/java-memory-playground.git
cd java-memory-playground
npm installStart the development server with hot reload:
npm run devThe application will be available at http://localhost:5173 (or another port if 5173 is in use).
Build the project for production:
npm run buildThe build output will be in the dist directory.
Run the test suite:
npm testsrc/- Source codeMemoryView.tsx- Main canvas for creating memory diagramsConfigView.tsx- Configuration view for defining classes and optionsstore.ts- State management with URL persistenceserde.ts- Serialization/deserialization for URL encodingmemory.ts- Type definitions for memory objects
public/- Static assetsdist/- Build output (generated)
- React - UI framework
- TypeScript - Type-safe JavaScript
- Vite - Build tool and dev server
- @xyflow/react - Flow diagram rendering
- Zustand - State management
- Pako - Compression for URL encoding
MIT