|
| 1 | +# HytaleSystemGC |
| 2 | + |
| 3 | +[](https://openjdk.org/) |
| 4 | +[](LICENSE) |
| 5 | +[](https://maven.apache.org/) |
| 6 | + |
| 7 | +A lightweight Hytale server plugin that automatically triggers garbage collection at configurable intervals to help manage memory usage. |
| 8 | + |
| 9 | +## ✨ Features |
| 10 | + |
| 11 | +- 🔄 **Automatic scheduled garbage collection** - Set it and forget it |
| 12 | +- ⚙️ **Configurable interval timing** - Customize GC frequency to your needs |
| 13 | +- 📊 **Smart logging** - Only logs when significant memory (>1MB) is reclaimed |
| 14 | +- 🪶 **Minimal overhead** - Uses daemon threads for zero impact on server shutdown |
| 15 | + |
| 16 | +## 📋 Requirements |
| 17 | + |
| 18 | +- Java 17 or higher |
| 19 | +- Maven 3.6+ (for building) |
| 20 | +- Hytale server with plugin support |
| 21 | + |
| 22 | +## 🚀 Installation |
| 23 | + |
| 24 | +### From Release |
| 25 | + |
| 26 | +1. Download the latest release JAR from the [Releases](https://github.com/zuedev/HytaleSystemGC/releases) page |
| 27 | +2. Place the JAR in your server's `plugins` folder |
| 28 | +3. Restart the server |
| 29 | + |
| 30 | +### Building from Source |
| 31 | + |
| 32 | +```bash |
| 33 | +# Clone the repository |
| 34 | +git clone https://github.com/zuedev/HytaleSystemGC.git |
| 35 | +cd HytaleSystemGC |
| 36 | + |
| 37 | +# Build with Maven |
| 38 | +mvn clean package |
| 39 | + |
| 40 | +# The JAR will be in target/HytaleSystemGC-1.0.0.jar |
| 41 | +``` |
| 42 | + |
| 43 | +## ⚙️ Configuration |
| 44 | + |
| 45 | +The plugin can be configured by modifying the `GCConfig` class or programmatically at runtime: |
| 46 | + |
| 47 | +| Setting | Default | Description | |
| 48 | +| ------------------------- | ------- | ---------------------------------------- | |
| 49 | +| `autoGcIntervalSeconds` | 10 | Seconds between GC runs (0 to disable) | |
| 50 | +| `minMemoryThresholdBytes` | 1048576 | Minimum bytes freed before logging (1MB) | |
| 51 | + |
| 52 | +### Programmatic Configuration |
| 53 | + |
| 54 | +```java |
| 55 | +GCConfig config = plugin.getConfig(); |
| 56 | +config.setAutoGcIntervalSeconds(30); // Run every 30 seconds |
| 57 | +config.setMinMemoryThresholdBytes(2097152); // Log when >2MB freed |
| 58 | +``` |
| 59 | + |
| 60 | +## 📁 Project Structure |
| 61 | + |
| 62 | +``` |
| 63 | +HytaleSystemGC/ |
| 64 | +├── src/ |
| 65 | +│ └── main/ |
| 66 | +│ ├── java/ |
| 67 | +│ │ └── com/zuedev/systemgc/ |
| 68 | +│ │ ├── AutoGC.java # GC scheduling logic |
| 69 | +│ │ ├── GCConfig.java # Configuration management |
| 70 | +│ │ ├── SystemGCPlugin.java # Main plugin entry point |
| 71 | +│ │ └── package-info.java # Package documentation |
| 72 | +│ └── resources/ |
| 73 | +│ └── hytale.json # Plugin manifest |
| 74 | +├── pom.xml # Maven build configuration |
| 75 | +├── LICENSE # Unlicense (Public Domain) |
| 76 | +├── CONTRIBUTING.md # Contribution guidelines |
| 77 | +└── README.md # This file |
| 78 | +``` |
| 79 | + |
| 80 | +## 🤝 Contributing |
| 81 | + |
| 82 | +Contributions are welcome! Please read our [Contributing Guidelines](CONTRIBUTING.md) before submitting a pull request. |
| 83 | + |
| 84 | +## 📄 License |
| 85 | + |
| 86 | +This project is released into the public domain under the Unlicense - see the [LICENSE](LICENSE) file for details. |
0 commit comments