On Wed, 21 Aug 2013 16:49:48 +0200 =?KOI8-R?B?z8zYx8Egy9LZ1sHOz9fTy8HR?= wrote: > Be aware, that memory obtained with MAP_UNINITIALIZED contains random > garbage, and is not zeroed out by the kernel.
> If course it will not affect libast because it zeros the memory any > way, regardless whether it is zeroed already (which is IMO a bug, > memory obtained directly via mmap() are already zeroed - except if > obtained with MAP_UNINITIALIZED and a suitably configured Linux > kernel, so why memset() them with zero again?) or not. the 0'ing of memory by vmalloc is intentional it works around the problem of linux (and who knows what other systems) allocating pages it may not be able to deliver on this results in applications getting spurious core dumps because a chunk of memory obtained by a valid vmalloc allocation happened to be in a page that linux silently decided to not deliver core dumpe like this really get in the way of debugging individual applications and systems of applications that may contain legitimate memory problems MAP_UNINITIALIZED may still be of use because vmalloc could delay the 0'ing until the page level when it is about to return a chunk from a page that hasn't been touched yet -- at that level it may be sufficient to just touch the first byte in each page to make sure they are viable if someone wants to look at this have at it but keep in mind that for ast consumers * malloc failure due to insufficient memory is ok * failure via memory violation after malloc because kernel didn't deliver pages it had already reserved is not ok unless the kernel is about to panic > On Wed, Aug 21, 2013 at 4:44 PM, Glenn Fowler <[email protected]> wrote: > > > > sounds reasonable > > > > On Wed, 21 Aug 2013 16:01:23 +0200 Roland Mainz wrote: > >> Hi! > > > >> ---- > > > >> [More or less offtopic] > >> The Linux kernel setting "CONFIG_MMAP_ALLOW_UNINITIALIZED" is a build > >> time switch and not a runtime kernel tuneable, right ? > > > >> Background: > >> I'm looking into Linux/Android optimisations right now and AFAIK > >> libast's allocator could benefit from |mmap()|'ing anon memory using > >> |MAP_UNINITIALIZED| ... > > > >> ---- > > > >> Bye, > >> Roland > > > >> -- > >> __ . . __ > >> (o.\ \/ /.o) [email protected] > >> \__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer > >> /O /==\ O\ TEL +49 641 3992797 > >> (;O/ \/ \O;) > >> _______________________________________________ > >> ast-developers mailing list > >> [email protected] > >> http://lists.research.att.com/mailman/listinfo/ast-developers > > > > _______________________________________________ > > ast-developers mailing list > > [email protected] > > http://lists.research.att.com/mailman/listinfo/ast-developers > -- > , _ _ , > { \/`o;====- Olga Kryzhanovska -====;o`\/ } > .----'-/`-/ [email protected] \-`\-'----. > `'-..-| / http://twitter.com/fleyta \ |-..-'` > /\/\ Solaris/BSD//C/C++ programmer /\/\ > `--` `--` _______________________________________________ ast-developers mailing list [email protected] http://lists.research.att.com/mailman/listinfo/ast-developers
