<pre class="notranslate">unsafe.Sizeof(image.RGBAColor{}) == 8

this means that a 32-bit-per-pixel image actually
uses 64 bits, which seems a harsh price to pay.

in general, i'd hope that a struct size be padded
to fulfill the alignment requirement of its largest member
and no more.</pre>
<p dir="auto">multipart.ReadForm is supposed to store up to maxMemory bytes in RAM and then the remainder on disk. The idea, presumably, is to prevent RAM exhaustion.</p>
<p dir="auto">Temporary files are created using ioutil.TempFile. os.TempDir is used to determine the temporary directory to use. However, os.TempDir() returns $TMPDIR, or, failing that, "/tmp".</p>
<p dir="auto">The problem is that on modern Linux systems, /tmp is a tmpfs and is thus hosted in RAM. This defeats the entire objective of saving large multipart parts to files.</p>
<p dir="auto">/var/tmp should always be backed by disk. The FHS states the purpose of "/var/tmp" as "temporary files preserved between system reboots." multipart should use /var/tmp, not /tmp.</p>
<p dir="auto">(Since there is no actual need for temporary multipart files to be preserved across reboots, it would be nice if the FHS provided something in between, thus allowing for periodic deletion on boot or so on, but alas it does not.)</p>
<p dir="auto">Possible solutions:</p>
<ul dir="auto">
<li>Introduce an os.LargeTempDir() which returns a temporary directory to be used for large files. Change multipart to pass this value to ioutil.TempFile.</li>
</ul>