RFC eliminating zeroing of heap/workspace

Joel Sherrill joel.sherrill at oarcorp.com
Fri Apr 6 11:20:47 UTC 2007


Sergei Organov wrote:
> Joel Sherrill <joel.sherrill at oarcorp.com> writes:
>   
>> Hi,
>>
>> I have done some investigation on a simulator
>> and determined that much of the time required
>> to bring the minimum test from reset to the
>> first task is consumed by zero'ing the
>> C Program Heap and RTEMS Workspace.
>>
>> My testing is on a simulated system which
>> has 4MB of RAM and zeroes all but maybe
>> 64K of it since that is the code and data.
>> It takes 97% of the boot time to clear this
>> much RAM.
>>
>> What's the general sentiment about clearing:
>>
>> + the C program heap
>> + the RTEMS workspace
>>     
>
> As the author of current RTEMS heap/workspace allocator, I'd like to say
> that even if you clear all the RAM allocated for heap/workspace, the
> heap allocation routine will still return a pointer to memory where
> first few bytes are non-zero (even on very first call to allocate), so
> clearing the RAM doesn't ensure that the memory you get from allocator
> is zero-initialized.
>
> As this new allocator is already in use for quite a long time, I think
> that the risk of breaking some code that still relies on
> zero-initializing heap/workspace is rather low, as such code has likely
> been already broken by the new allocator.
>   
And RTEMS would definitely be broken since eventually you reuse object 
control
blocks and they are dirty the second time around.

Sounds safe to change the default on the CVS head and go with it.  A BSP can
always say it needs to do a clear for the reasons mentioned.

--joel




More information about the users mailing list