{"id":29295604,"url":"https://github.com/yeautyye/auto-allocator","last_synced_at":"2026-05-17T03:39:05.121Z","repository":{"id":302209128,"uuid":"1011143908","full_name":"YeautyYE/auto-allocator","owner":"YeautyYE","description":"🚀 Zero-config automatic memory allocator for Rust - just add one line and get up to 1.6x faster allocation performance   across all platforms","archived":false,"fork":false,"pushed_at":"2025-07-01T05:15:43.000Z","size":53,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-01T06:25:08.882Z","etag":null,"topics":["allocator","automatic","cross-platform","embedded","hardware-aware","high-performance","memory-management","memory-optimization","mimalloc","no-std","performance","rust","systems-programming","wasm","zero-config"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/YeautyYE.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-30T11:19:14.000Z","updated_at":"2025-07-01T05:15:46.000Z","dependencies_parsed_at":"2025-07-01T06:35:32.074Z","dependency_job_id":null,"html_url":"https://github.com/YeautyYE/auto-allocator","commit_stats":null,"previous_names":["yeautyye/auto-allocator"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/YeautyYE/auto-allocator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YeautyYE%2Fauto-allocator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YeautyYE%2Fauto-allocator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YeautyYE%2Fauto-allocator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YeautyYE%2Fauto-allocator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YeautyYE","download_url":"https://codeload.github.com/YeautyYE/auto-allocator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YeautyYE%2Fauto-allocator/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266829008,"owners_count":23991222,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-24T02:00:09.469Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["allocator","automatic","cross-platform","embedded","hardware-aware","high-performance","memory-management","memory-optimization","mimalloc","no-std","performance","rust","systems-programming","wasm","zero-config"],"created_at":"2025-07-06T14:08:37.924Z","updated_at":"2025-10-28T00:42:00.534Z","avatar_url":"https://github.com/YeautyYE.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 Auto-Allocator\n\n[![Crates.io](https://img.shields.io/crates/v/auto-allocator.svg)](https://crates.io/crates/auto-allocator)\n[![Documentation](https://img.shields.io/badge/docs.rs-auto--allocator-blue)](https://docs.rs/auto-allocator)\n[![License: MIT/Apache-2.0/MPL-2.0](https://img.shields.io/badge/License-MIT%2FApache--2.0%2FMPL--2.0-brightgreen.svg)](https://github.com/YeautyYE/auto-allocator/blob/main/LICENSE-APACHE)\n[![Rust Version](https://img.shields.io/badge/Rust-%3E=1.80.0-orange)](https://www.rust-lang.org/)\n\n\u003e **🎯 One line of code. Platform-intelligent optimization. Zero configuration.**\n\nThe smartest memory allocator for Rust that automatically selects the optimal allocator for your platform - delivering performance improvements where possible, and platform compliance where required.\n\n## 🌟 Why Developers Choose Auto-Allocator\n\n**🎯 Smart Optimization for Every Platform**\n- **Performance where it helps**: 1.6x faster on multi-core Windows/macOS/Linux ([Microsoft Research](https://www.microsoft.com/en-us/research/uploads/prod/2019/06/mimalloc-tr-v1.pdf))\n- **Compliance where it matters**: Respects Android/iOS official policies  \n- **Efficiency everywhere**: Optimal allocation from servers to microcontrollers\n\n**⚡ Effortless Integration**  \n- **Truly zero-config** - just `use auto_allocator;` and you're optimized\n- **Universal compatibility** - works on every Rust platform\n- **Production ready** - handles platform differences automatically\n\n**🧠 Platform Intelligence**\n- **Respects each platform's strengths** - leverages native optimizations when better\n- **Hardware-aware** - adapts to CPU cores and memory constraints\n- **Research-backed** - every choice has technical justification\n\n## ⚡ Quick Start\n\n### 1. Add Dependency\n```toml\n[dependencies]\nauto-allocator = \"*\"\n```\n\n### 2. Import and Use\n```rust\nuse auto_allocator;  // 🎉 Done! Memory allocation is now optimized\n\nfn main() {\n    // Your existing code automatically benefits from optimal allocation\n    let data = vec![1, 2, 3, 4, 5];\n    let text = \"Hello\".repeat(1000);\n    \n    // No changes needed - just faster memory operations! \n    println!(\"🚀 High-performance allocation active!\");\n}\n```\n\n### 3. Verify Optimization (Optional)\n```rust\nuse auto_allocator;\n\nfn main() {\n    let info = auto_allocator::get_allocator_info();\n    println!(\"✅ Using: {:?}\", info.allocator_type);\n    println!(\"💡 {}\", info.reason);\n}\n```\n\n**✨ That's literally all you need!** Auto-Allocator handles everything else automatically.\n\n## 🔬 How It Works\n\nAuto-Allocator uses **intelligent two-phase optimization**:\n\n```\n📋 COMPILE TIME                    🚀 RUNTIME                    ✅ RESULT\n┌─────────────────┐               ┌─────────────────┐           ┌─────────────────┐\n│ Platform        │               │ CPU Core Count  │           │                 │\n│ Detection       │──────────────▶│ Analysis        │──────────▶│ Optimal         │\n│                 │               │                 │           │ Allocator       │\n│ Compiler        │               │ Memory          │           │ Selection       │\n│ Analysis        │──────────────▶│ Detection       │──────────▶│                 │\n│                 │               │                 │           │                 │\n│ Feature         │               │ Hardware        │           │                 │\n│ Availability    │──────────────▶│ Optimization    │──────────▶│                 │\n└─────────────────┘               └─────────────────┘           └─────────────────┘\n\n🎯 90% of decisions made at compile-time for zero runtime overhead\n⚡ Only high-performance platforms need runtime CPU detection\n```\n\n### 🎯 Platform-Specific Selection\n\n| Platform | Selected Allocator | Expected Benefit | Technical Reason |\n|----------|-------------------|------------------|------------------|\n| **🖥️ Windows/macOS/Linux (Multi-core)** | **mimalloc** | **1.6x faster allocation** | Microsoft Research-proven performance |\n| **📱 Android** | **Scudo** | Platform security compliance | Google's official security policy |\n| **📱 iOS** | **libmalloc** | Deep system integration | Apple's optimization recommendation |\n| **🔒 BSD/Solaris** | **Native allocator** | Already optimal | Platform-tuned performance |\n| **🤖 Embedded** | **embedded-alloc** | Resource efficiency | Designed for constraints |\n| **🐛 Debug builds** | **System** | Fast compilation | Development speed priority |\n| **🌐 WASM** | **System** | Browser compatibility | Web standard compliance |\n\n### 🚀 Performance Results\n\n**When mimalloc is selected** (Windows/macOS/Linux multi-core):\n- **1.6x faster allocation** in multi-threaded scenarios ([Microsoft Research](https://www.microsoft.com/en-us/research/uploads/prod/2019/06/mimalloc-tr-v1.pdf))\n- **Reduced lock contention** through free-list sharding\n- **Better cache locality** and lower memory fragmentation\n\n**Test it yourself**:\n```bash\ncargo bench  # Benchmark your specific workload\n```\n\n**Key insight**: Auto-Allocator delivers performance improvements where they matter, while respecting platform policies elsewhere.\n\n## 🛡️ Security Features\n\n### 🔒 When Available (Platform-Dependent)\n\nSecurity features are **only available on platforms that use mimalloc-secure**:\n\n```toml\n# Only effective on Windows/macOS/Linux with mimalloc support\n[dependencies]\nauto-allocator = { version = \"*\", features = [\"secure\"] }\n```\n\n### 🎯 Platform-Specific Security\n\n| Platform | Secure Mode Effect | Security Features |\n|----------|-------------------|-------------------|\n| **🖥️ Windows/macOS/Linux** | **mimalloc-secure activated** | Guard pages, encrypted free lists, randomization |\n| **📱 Android** | **No change** (uses Scudo) | Android's built-in security (UAF protection) |\n| **📱 iOS** | **No change** (uses libmalloc) | iOS system-level protections |\n| **🔒 BSD/Solaris** | **No change** (native allocators) | Platform built-in security hardening |\n| **🌐 WASM** | **No change** (browser sandbox) | Browser security model isolation |\n| **🤖 Embedded** | **No change** (resource constraints) | Standard embedded safety measures |\n\n### 📊 Security Trade-offs\n\n| Configuration | Performance | Security Level | Available On |\n|---------------|-------------|----------------|--------------|\n| **Default** | 100% speed | Rust safety + platform defaults | All platforms |\n| **Secure** | 90% speed | Enhanced heap protection | Windows/macOS/Linux only |\n\n**💡 Key insight**: Many platforms already have excellent built-in security - Auto-Allocator respects and leverages these instead of overriding them.\n\n\n## 🛠️ Advanced Usage\n\n### 🔍 Check What's Being Used\n\n```rust\nuse auto_allocator;\n\nfn main() {\n    // 🔍 Inspect current allocator selection\n    let info = auto_allocator::get_allocator_info();\n    println!(\"🚀 Active: {:?}\", info.allocator_type);\n    println!(\"💡 Why: {}\", info.reason);\n    \n    // 📈 System specifications  \n    println!(\"🖥️  Hardware: {} cores, {} RAM\", \n             info.system_info.cpu_cores,\n             auto_allocator::format_memory_size(info.system_info.total_memory_bytes));\n    \n    // ✅ Validate optimal configuration\n    let (is_optimal, suggestion) = auto_allocator::check_allocator_optimization();\n    if !is_optimal {\n        println!(\"⚠️  Optimization tip: {}\", suggestion.unwrap());\n    }\n    \n    // 🎯 Get platform-specific recommendations\n    let (recommended, reason) = auto_allocator::get_recommended_allocator();\n    println!(\"💯 Recommended: {:?} - {}\", recommended, reason);\n}\n```\n\n\n## 🔬 Technical Deep-Dive\n\n### 🏆 Why mimalloc Dominates Performance\n\n**🎯 Peer-Reviewed Research**:\n- [**Microsoft Research Study**](https://www.microsoft.com/en-us/research/uploads/prod/2019/06/mimalloc-tr-v1.pdf): **1.6x faster** than jemalloc in production\n- **Free-list sharding**: Eliminates lock contention in multi-threaded applications\n- **Cache-conscious design**: Better memory locality = faster access patterns\n- **Battle-tested**: Powers Microsoft Azure, Office 365, and Windows services\n\n\n## 💡 Examples \u0026 Tutorials\n\nExplore real-world usage in the [`examples/`](examples/) directory:\n\n| Example | Use Case | What You'll Learn |\n|---------|----------|-------------------|\n| **[🚀 simple_demo](examples/simple_demo/)** | Basic integration | Zero-config setup + system introspection |\n| **[✅ optimization_check](examples/optimization_check/)** | CI/CD validation | Automated performance verification |\n| **[🌐 web_server](examples/web_server/)** | Production server | High-throughput web application |\n| **[🤖 embedded_system](examples/embedded_system/)** | IoT/Embedded | Resource-constrained optimization + Real no_std compilation |\n\n## 📄 License\n\n**Flexible licensing** for maximum compatibility:\n\n- **[MIT License](LICENSE-MIT)** - Permissive, commercial-friendly\n- **[Apache License 2.0](LICENSE-APACHE)** - Enterprise-preferred, patent protection  \n- **[Mozilla Public License 2.0](LICENSE-MPL)** - Copyleft alternative\n\n**Choose the license that best fits your project!**\n\n## 🎓 Research \u0026 References\n\n### 📚 Core Research\n- **[mimalloc: Free List Sharding in Action](https://www.microsoft.com/en-us/research/uploads/prod/2019/06/mimalloc-tr-v1.pdf)** - Microsoft Research\n- **[A Scalable Concurrent malloc(3) Implementation](https://people.freebsd.org/~jasone/jemalloc/bsdcan2006/jemalloc.pdf)** - Jason Evans (Facebook)\n\n### 🏢 Platform Documentation  \n- **[Android Scudo Hardened Allocator](https://source.android.com/docs/security/test/scudo)** - Android AOSP\n- **[Apple Memory Management Guidelines](https://developer.apple.com/library/archive/documentation/Performance/Conceptual/ManagingMemory/Articles/MemoryAlloc.html)** - Apple Developer\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyeautyye%2Fauto-allocator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyeautyye%2Fauto-allocator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyeautyye%2Fauto-allocator/lists"}