1

Is using lseek to extend a file guaranteed to create a sparse file

view story
linux-howto

http://stackoverflow.com – I have been reducing the memory footprint of a program that uses several large arrays I have been working on by using file mapping. Since I don't know the desired size of these arrays I am overestimating the size to a level I know the arrays won't reach, and then truncating the files down to the final size I am finished with the arrays. Fortunately the code I am using to create the mapped files (at the bottom of this post), creates sparse files on every machine I have tried. If it didn't there would be a disk space problem. Question is: is calling lseek to extend the file prior to mapping gua (HowTos)