Intervention / Intervention/image
Memory leaks when using insert function, even with destroy.
Open
Nobody has claimed this yet.
investigation-needed
- Dominant language
- PHP
- Stars
- 14.4k
- Forks
- 1.5k
- Avg merge
- 17h 51m
- Merged PRs (30d)
- 11
Description
I wrote a laravel command to operate many images, something like that:
while (true) { // use while-true to simulate lots of images
foreach (Storage::files('tmp') as $file) {
echo $file, "\n";
$image = Image::make(storage_path('app/' . $file));
// $img = Image::make(storage_path('app/' . $file));
$img = clone($image);
$img->crop(200, 100);
// $this->some($img);
$image->insert($img);
$image->save(storage_path('tmp.png')); // without this save, grows much slower. It is another encode leaks issue I think.
$img->destroy(); // without these two destroy, script booms very quickly.
$image->destroy();
usleep(25);
}
}
The memory usage grows about 1M per second on my PC.
By the way, I am using GD2 driver on Windows. Maybe it's an issue of GD? I will try it on Linux later.
Anyidea?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the memory growth from the command example while varying insert(), save(), and destroy() calls with the GD2 driver. Compare behavior on the reported Windows environment and Linux if available; done means identifying whether the leak is in this library's image operations or GD2 and documenting a confirmed fix or limitation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100