We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, the following code is a simplified version of my code. Here, I'm trying to do some image processing on the image buffer.
package main import "github.com/h2non/bimg" func resizeAndConvertImage(image []byte, height int, width int) ([]byte, error) { size, err := bimg.NewImage(image).Size() if err != nil { return nil, err } if width == 0 && height == 0 { width = size.Width height = size.Height } options := bimg.Options{ Width: width, Height: height, } imgType := bimg.JPEG image, _ = bimg.NewImage(image).Process(options) image, _ = bimg.NewImage(image).Convert(imgType) return image, err } func main() { newImage, err := resizeAndConvertImage(imageBuffer, height, width) }
I used a script for hitting so many requests to the server.
I started the script at 11:31 and stopped it at 11:38. It can be clearly seen that around 2GB of memory is stucked somewhere.
Then I tried commenting Process() and Convert() functions one by one.
// image, _ = bimg.NewImage(image).Process(options)
// image, _ = bimg.NewImage(image).Convert(imgType)
And graph showed around 1GB of memory leakage. (script start time is 11:53)
Then I commented both the function calls.
// image, _ = bimg.NewImage(image).Process(options) // image, _ = bimg.NewImage(image).Convert(imgType)
And the memory graph shows that there is no memory leakage. Memory used is just in MBs.
Am I missing something obvious here?
I have also tried following options for the fix
os.Setenv("GODEBUG", "madvdontneed=1") bimg.VipsCacheSetMax(0) bimg.VipsCacheSetMaxMem(0) os.Setenv("MALLOC_ARENA_MAX", "2")
The text was updated successfully, but these errors were encountered:
Facing the same issue in process and convert function.
Sorry, something went wrong.
have you tried setting MALLOC_ARENA_MAX=2 ?
MALLOC_ARENA_MAX=2
Any solution for this?
No branches or pull requests
Hi, the following code is a simplified version of my code. Here, I'm trying to do some image processing on the image buffer.
I used a script for hitting so many requests to the server.
I started the script at 11:31 and stopped it at 11:38. It can be clearly seen that around 2GB of memory is stucked somewhere.
Then I tried commenting Process() and Convert() functions one by one.
And graph showed around 1GB of memory leakage. (script start time is 11:53)
Then I commented both the function calls.
And the memory graph shows that there is no memory leakage. Memory used is just in MBs.
Am I missing something obvious here?
I have also tried following options for the fix
The text was updated successfully, but these errors were encountered: