Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - MALLOC_MMAP_NOZERO: (8 Items)
   
MALLOC_MMAP_NOZERO  
The doc says this is a SH architectures only but on x86 it makes malloc much faster, when the heap needs to grow ;-)



Re: MALLOC_MMAP_NOZERO  
On Wed, Nov 18, 2009 at 10:33:52AM -0500, Mario Charest wrote:
> The doc says this is a SH architectures only but on x86 it makes malloc much faster, when the heap needs to grow ;-)

The doc's wrong - the environment variable turns on the MAP_NOINIT flag
to mmap(), which has been supported on all architectures since 6.3.2.

-- 
Brian Stecher (bstecher@qnx.com)        QNX Software Systems
phone: +1 (613) 591-0931 (voice)        175 Terence Matthews Cr.
       +1 (613) 591-3579 (fax)          Kanata, Ontario, Canada K2M 1W8
RE: MALLOC_MMAP_NOZERO  
I've created a doc PR. Thanks for pointing this out.


Steve Reid (stever@qnx.com)
Technical Editor
QNX Software Systems 
 

> -----Original Message-----
> From: Brian Stecher [mailto:community-noreply@qnx.com] 
> Sent: Wednesday, November 18, 2009 10:44 AM
> To: ostech-core_os
> Subject: Re: MALLOC_MMAP_NOZERO
> 
> On Wed, Nov 18, 2009 at 10:33:52AM -0500, Mario Charest wrote:
> > The doc says this is a SH architectures only but on x86 it 
> makes malloc much faster, when the heap needs to grow ;-)
> 
> The doc's wrong - the environment variable turns on the 
> MAP_NOINIT flag
> to mmap(), which has been supported on all architectures since 6.3.2.
> 
> -- 
> Brian Stecher (bstecher@qnx.com)        QNX Software Systems
> phone: +1 (613) 591-0931 (voice)        175 Terence Matthews Cr.
>        +1 (613) 591-3579 (fax)          Kanata, Ontario, 
> Canada K2M 1W8
> 
> 
> 
> _______________________________________________
> 
> OSTech
> http://community.qnx.com/sf/go/post42167
> 
> 
Re: MALLOC_MMAP_NOZERO  
the doc is wrong.. that information has probably remained from an
earlier release, where it was implemented in the context of SH alone

shiv
Wed Nov 18 10:50:49 EST 2009

 --> According to Mario Charest <--
	
	The doc says this is a SH architectures only but on x86 it makes malloc
	much faster, when the heap needs to grow ;-)
	
	
	
	
	
	
	
	_______________________________________________
	
	OSTech
	http://community.qnx.com/sf/go/post42164
	

-- 
****
Shiv Nagarajan,
Kernel Developer, QNX Software Systems,
Ottawa, Canada
****
Re: MALLOC_MMAP_NOZERO  
Here's what I've changed the description to:

MALLOC_MMAP_NOZERO
    If this environment variable is nonzero, then when malloc() needs to expand the heap, it specifies the MAP_NOINIT 
flag when it calls mmap(); if the physical memory being mapped was previously unmapped with UNMAP_INIT_OPTIONAL, then 
the POSIX requirement that the memory be zeroed is relaxed. For more information, see “Initializing allocated memory” 
in the Interprocess Communication (IPC) chapter of the System Architecture guide. 

Is that correct?
Re: MALLOC_MMAP_NOZERO  
Looks good.

On Fri, Nov 20, 2009 at 03:07:51PM -0500, Steve Reid wrote:
> Here's what I've changed the description to:
> 
> MALLOC_MMAP_NOZERO
>     If this environment variable is nonzero, then when malloc() needs to expand the heap, it specifies the MAP_NOINIT 
flag when it calls mmap(); if the physical memory being mapped was previously unmapped with UNMAP_INIT_OPTIONAL, then 
the POSIX requirement that the memory be zeroed is relaxed. For more information, see ???Initializing allocated memory??
? in the Interprocess Communication (IPC) chapter of the System Architecture guide. 
> 
> Is that correct?
> 
> 
> 
> 
> _______________________________________________
> 
> OSTech
> http://community.qnx.com/sf/go/post42334

-- 
Brian Stecher (bstecher@qnx.com)        QNX Software Systems
phone: +1 (613) 591-0931 (voice)        175 Terence Matthews Cr.
       +1 (613) 591-3579 (fax)          Kanata, Ontario, Canada K2M 1W8
Re: MALLOC_MMAP_NOZERO  
> Here's what I've changed the description to:
> 
> MALLOC_MMAP_NOZERO
>     If this environment variable is nonzero, then when malloc() needs to 
> expand the heap, it specifies the MAP_NOINIT flag when it calls mmap(); if the
>  physical memory being mapped was previously unmapped with UNMAP_INIT_OPTIONAL
> , then the POSIX requirement that the memory be zeroed is relaxed. For more 
> information, see “Initializing allocated memory” in the Interprocess 
> Communication (IPC) chapter of the System Architecture guide. 
> 
> Is that correct?


Now, the question is, if anyone in the system does ever unmap memory with UNMAP_INIT_OPTIONAL except for those few rare 
nerds who might use mmap/munmap for managing memory. ;)
Re: MALLOC_MMAP_NOZERO  
On Mon, Nov 23, 2009 at 03:21:32AM -0500, Oleh Derevenko wrote:
> Now, the question is, if anyone in the system does ever unmap memory with UNMAP_INIT_OPTIONAL except for those few 
rare nerds who might use mmap/munmap for managing memory. ;)

It's considered set for any memory that's never been allocated before, so 
it can help with boot up speed.

Also, if you use the "-m~i" on the procnto command line, a normal munmap() 
will act like UNMAP_INIT_OPTIONAL is set. 

-- 
Brian Stecher (bstecher@qnx.com)        QNX Software Systems
phone: +1 (613) 591-0931 (voice)        175 Terence Matthews Cr.
       +1 (613) 591-3579 (fax)          Kanata, Ontario, Canada K2M 1W8