1

I am using ImageMagick to process large TIFF images, and I am running into memory issues as the processing happens in a limited resource environment (Function Compute on Alibaba, which is almost identical to AWS Lambda). Sometimes the process runs out of memory, and sometimes it runs out of temporary disk space.

I believe I am currently using a 64-bit version of ImageMagick's convert binary. If I were to custom compile ImageMagick binary under 32-bit, is there a change my image processing might use half the memory?

I believe the answer is no, but I just want to double check. My guess is that the convert binary loaded into memory will simply be half the size, and the actual image processing will use the same amount of memory as when using a 64-bit version of convert.

2
  • 2
    There's some ImageMagick tuning which might be worth a try, if you haven't looked into it already, see serverfault.com/questions/97340/… (relates to all operations, not just PDF) Commented Jul 6, 2018 at 19:42
  • 2
    Also the stream facilities could be of interest. imagemagick.org/script/stream.php Commented Jul 6, 2018 at 19:43

2 Answers 2

4

64 bit vs. 32 bit programs generally just affect the amount of memory that the program can address directly. The programs themselves may not take up much more space in memory other than a small amount for the size of variables inside the programs. IE: an int in a C program on 32 bit binaries has a maximum value of around 2 billion; an int on 64 bit binaries has a maximum value of 9,223,372,036,854,780,000. Now a 64 bit program could read in or process data in a much larger memory space, but the program itself won't use much more memory.

Short answer: 32 bit binary won't help if you are processing a large data file.

3

Well, 64-bit vs 32-bit does change the run-time memory usage somewhat, in that it changes the size of pointers. On amd64, an int (the default integer type) is still 32 bits, so that doesn't change. But a program that uses pointer-heavy data structures, like trees or linked lists; or a high-level language interpreter that accesses all variables through pointers, may be affected. Having a 64-bit pointer to a (say) 128-bit structure will have a 50 % overhead, while with 32-bit pointers it's only 25 %.

Exactly because of the pointer size, there's actually an ABI specification for using 32-bit applications on 64-bit amd64 systems, but I don't think it's received much traction. See x32 ABI on Wikipedia.

Since ImageMagick deals with image data, which is mostly just arrays of numbers, it's probably not going to be affected much.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.