sakanjo / memory-limited
A package to limit the memory upon a function call.
                                    Fund package maintenance!
                                                                            
                                                                                                                                        sakanjo
                                                                                    
                                                                
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 7
Watchers: 1
Forks: 1
Open Issues: 0
pkg:composer/sakanjo/memory-limited
Requires (Dev)
- laravel/pint: ^1.13
This package is auto-updated.
Last update: 2025-10-20 22:21:52 UTC
README
Don't eat my memory please
⨠Help support the maintenance of this package by sponsoring me.
Table of contents
đĻ Install
composer require --dev sakanjo/memory-limited
đĻ Usage
use function Sakanjo\MemoryLimited\run_memory_limited; function memoryEater(): mixed { return memoryEater(); } run_memory_limited(mb: 20, callback: function() { memoryEater(); // It will throw FATAL when reaching 20M of memory, instead of hanging the system });
Voila, that's it!
Pay attention that this package is only used in development mode for testing purposes, it will throw Fatal error when the memory limit is reached.
đ Support the development
Do you like this project? Support it by donating
Click the "đ Sponsor" at the top of this repo.
ÂŠī¸ Credits
đ License
MIT License Š 2023-PRESENT Salah Kanjo