-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
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
Segmentation fault (core dumped) from pyvips #41
Comments
Hello again, You can do a range of things to limit libvips memory use:
|
I tried this program: #!/usr/bin/python
import sys
import pyvips
pyvips.leak_set(True)
image = pyvips.Image.new_from_file(sys.argv[1], access='sequential')
image = image.resize(0.8 / 1.0)
image.write_to_file(sys.argv[2])
If I change the program like this: #!/usr/bin/python
import sys
import pyvips
pyvips.cache_set_max(0)
pyvips.leak_set(True)
image = pyvips.Image.thumbnail(sys.argv[1], 8000)
image.write_to_file(sys.argv[2]) I see:
That's running with |
Sorry, I never answered your first question. Out of memory errors are generally impossible to handle gracefully. Suppose memory is full and a fault is raised. What is going to handle the error? If no more memory can be used, no fault handler can execute. Like almost all software, libvips treats memory as an infinite resource and relies on the environment to manage it. libvips does check large single allocations (for example, loading a 10gb image into memory), but does not check small ones, the reasoning being that, if a small allocation fails, the process is as good as dead. |
Thanks a lot. I tried your example code: #!/usr/bin/python
import sys
import pyvips
pyvips.cache_set_max(0)
pyvips.leak_set(True)
image = pyvips.Image.thumbnail(sys.argv[1], 8000)
image.write_to_file(sys.argv[2]) but my output was like:
I checked that I had And where should I use |
It should be Otherwise it's probably because you are using an old version of the libvips shared library.
|
we are having same issue when creating large image files around 2 gb + |
Hello @abhijitgujar86, Please open a new issue and include as much information as you can about the crash. Ideally, a reproducible test case. |
I'm trying to resize a large image to a smaller width with a limited memory available 256MB (due to AWS lambda configuration). I used the code like this:
In my local machine I'm testing it by putting a limit on Python VM using code like:
when I set the
maxsize
to 256MB, I getSegmentation fault (core dumped)
error. I suppose this is coming from the vips C library. So, I have two questions:The text was updated successfully, but these errors were encountered: