RFC eliminating zeroing of heap/workspace

Sergei Organov osv at javad.com
Fri Apr 6 10:22:07 UTC 2007


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.

-- 
Sergei.



More information about the users mailing list