<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Dec 18, 2013 at 11:46 AM, Even Rouault <span dir="ltr"><<a href="mailto:even.rouault@mines-paris.org" target="_blank">even.rouault@mines-paris.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Le mercredi 18 décembre 2013 19:53:37, Frank Warmerdam a écrit :<br>
> Even,<br>
><br>
<div class="im">> Sorry, I was thinking of mmap() directly to the file, and having something<br>
> like:<br>
><br>
> CPLVirtualMem CPL_DLL* GDALBandGetVirtualMemAuto( GDALRasterBandH hBand,<br>
>                                          int *pnPixelSpace,<br>
>                                          GIntBig *pnLineSpace,<br>
>                                          char **papszOptions );<br>
><br>
> I imagined an available virtual method on the band which could be<br>
> implemented - primarily by the RawBand class to try and mmap() the data and<br>
> return the layout.  But when that fails, or is unavailable it could use<br>
> your existing methodology with a layout that seems well tuned to the<br>
> underlying data organization.<br>
<br>
</div>Yes, that should be doable, but with the limitation I raised about the memory<br>
management of file-based mmap() : if you mmap() a file larger than RAM, and read<br>
it entirely, without explicit madvise() to discard regions no longer needed,<br>
it will fill RAM and cause disk swapping. I should retest to confirm. Perhaps </blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">there are some OS level tuning to avoid that ?<br>
</blockquote><div><br></div><div>Even,</div><div><br></div><div>That was not my experience for readonly mmap() of actual files on disk "back in the day".  </div><div><br></div><div>In any event, I'd suggest sticking with what you have, and if I'm keen perhaps one day I'll try and implement mmap() support.  If I do, I feel like it needs to go down through the VSI*L system and once a file is mmapped() the VSI*L IO should also be using the mmaped images.  Once upon a time this had performance benefits. I'm not sure if that is the case any more.</div>
<div><br></div><div>Best regards,</div><div>Frank</div><div><br></div></div>-- <br>---------------------------------------+--------------------------------------<br>I set the clouds in motion - turn up   | Frank Warmerdam, <a href="mailto:warmerdam@pobox.com" target="_blank">warmerdam@pobox.com</a><br>
light and sound - activate the windows | <a href="http://pobox.com/~warmerdam" target="_blank">http://pobox.com/~warmerdam</a><br>and watch the world go round - Rush    | Geospatial Software Developer<br>
</div></div>