in reply to mmap in Perl?
Thanx for above Re^4, RobinV. This contained the missing info & confirmed the missing reader to be my suspected kitten, ahem - cat :). Btw. did you notice that your indenting didn't quite survive pasting?
Observation: It looks to me like $mmap isn't synced to file (or maybe even to the mmapped memory?) if the length changed, even if the new value _remains_ usable within the script. Modify your writer similar to the scrap below to make it work, but choose something more sensible than my substring mess.
# WORKS -- but it's suddenly quite slow due to synchronous sync :) for(my $i=0;$i<105;++$i) { substr($mmap,0,2) = substr($i . (" "x20) ,0,2); sync($mmap,1); }
Question: isn't this a bug / incomplete documentation? IMHO there should be a way to at least optionally turn on a warning or error somehow for this case, otherwise that's a good place for hard-to-find bugs. (I also forwarded the URL for this thread to the module's author for a rain check. Maybe I missed something when skimming the module's documentation)
Maybe worth a check: There are more mmap modules on CPAN besides File::Map (Cache::FastMmap, Sys::Mmap + ::Simple, IPC::Mmap) some of which may turn out to be less rigid in assignments, maybe allowing implied remapping, padding or substring-insertion for shorter assignments.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: mmap in Perl?
by Leon Timmermans (Acolyte) on Oct 21, 2009 at 20:21 UTC | |
by jakobi (Pilgrim) on Oct 21, 2009 at 20:57 UTC | |
by Anonymous Monk on Oct 22, 2009 at 12:05 UTC | |
|
Re^2: mmap in Perl?
by RobinV (Sexton) on Oct 21, 2009 at 07:29 UTC | |
by jakobi (Pilgrim) on Oct 21, 2009 at 09:25 UTC | |
by jakobi (Pilgrim) on Oct 21, 2009 at 09:29 UTC |