Chris DiTrani wrote: > > I was doing a backup of a NFS partition (about 300 MB) using zip but I got the > > error: > > Zip error: Out of memory (allocating temp filename) > So I can't see how tempname() returns a NULL pointer under any > circumstance other than malloc failing. Which could be a side-effect of > the heap getting buggered by other code, or maybe you really are out of > mem. Looks like zip allocates mem for every file it finds and only frees > it after it's done, so it's not the size of the backup set so much as it > is the number of files that impact memory use. That makes sense. The zip format stores all file information in a directory at the end of the file. The size of the directory will be proportional to the number of files in the archive, and I suspect that it will store this information in memory rather than a temporary file (most zip files don't contain an entire filesystem). One solution would be to create a .tar.gz (or .tar.bz2) file instead. A tar file stores each file's information in a header preceding the file's contents, so there is no need to accumulate the information in memory. OTOH, one disadvantage of tar files is that listing the contents requires scanning the entire file, whereas listing a zip file only involves seeking to the directory then listing it (although this requires that the zip file is stored on a medium which supports random access, i.e. not on tape). -- Glynn Clements <glynn.clements@xxxxxxxxxx> - : send the line "unsubscribe linux-admin" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html