libvips / pyvips

python binding for libvips using cffi
MIT License
640 stars 49 forks source link

Memory leaking when operate and write with big ndarray #188

Open xkxxfyf opened 4 years ago

xkxxfyf commented 4 years ago

hi, I have a problem that when I use pyvips to process adarray, the memory suddenly expands, causing it to run out of memory and crash. here is my code:

`

_of = array_to_image(field)

of_full = _of.resize(ratio, vscale=ratio)

Exy = pyvips.Image.xyz(field.shape[0]*ratio, field.shape[1]*ratio)

of_image = of_full.linear(ratio,0)

index = Exy.add(of_image)

warped_image = source.mapim(index)

warped_image.write_to_file(final_file, compression='jpeg', Q=70, bigtiff=True, pyramid=True, tile=True, tile_width=512, tile_height=512)

`

the field is a adarray, min is -30000 and max is 30000 ,size is 600 * 600 the ratio is 128

and my memory is 200G, when run this code, Memory is consumed quickly and Program crash.

xkxxfyf commented 4 years ago

my pyvips version is 8.9.2

jcupitt commented 4 years ago

Sorry, no idea. Please make a complete, runnable example I can test.