next up previous contents
Next: 3.8.3 Non-image output Up: 3.8 Joining operations together Previous: 3.8.1 How it works   Contents

3.8.2 Pitfalls with partials

To go with all of the benefits that partial image I/O brings, there are also some problems. The most serious is that you are often not quite certain when computation will happen. This can cause problems if you close an input file, thinking that it is finished with, when in fact that file has not been processed yet. Doing this results in dangling pointers and an almost certain core-dump.

You can prevent this from happening with careful use of im_open_local(). If you always open local to your output image, you can be sure that the input will not be closed before the output has been generated to a file or memory buffer. You do not need to be so careful with non-image arguments. VIPS functions which take extra non-image arguments (a matrix, perhaps) are careful to make their own copy of the object before returning.



John Cupitt 2004-11-02