[OSM-talk] Mapnik Tilecache Memory Error (Myanmar Cyclone Relief)

Tom Hughes tom at compton.nu
Tue Jun 10 21:08:37 BST 2008


Jon Burgess wrote:

> On Tue, 2008-06-10 at 10:40 +0200, Frederik Ramm wrote:
>
>>> Um... no. At least not if it does the sensible thing and maps it
>>> for shared read.
>> I don't think it is even possible to mmap somthing for "private read". 
>> The boost lib only ever sets the SHARED flag when it wants write access:
>>
>>      void* data = ::mmap( hint, pimpl_->size_,
>>             readonly ? PROT_READ : (PROT_READ |PROT_WRITE),
>>             readonly ? MAP_PRIVATE : MAP_SHARED,
>>             pimpl_->handle_, p.offset );
>>
>> I guess that a "shared" mode is implicitly used by mmap if you specify 
>> read access only; anything else would not make sense (and would mean 
>> that the boost guys got it wrong, which is not impossible but rare).
> 
> Those lines above imply that readonly mappings are flagged MAP_PRIVATE
> which looks a little odd. The the strace output below seems to confirm
> these these flags:

That does indeed look like a very odd thing to do...

> The two lines ** are memory maps of the same 300MB shapefiles though the
> fd's are different. This is being done concurrently by 2 threads and the
> resulting address mappings returned are different.

The actual physical memory will still be shared of course, but you will 
be exhausting your address space by having the physical memory mapped 
multiple times. That's especially true on 32 bit systems where address 
space is more limited.

Tom

-- 
Tom Hughes (tom at compton.nu)
http://www.compton.nu/




More information about the talk mailing list