Fix rosalloc issues with valgrind.
The issue was that the MemoryToolMallocSpace constructor was
explicitly undefining the tail of the mem map, and when RosAlloc
expanded the space beyond the initial size, it gets errors from using
the zero but undefined (due to the above undefining) memory
content. RosAlloc zeroes memory on free (as opposed to zeroes on
allocation) and relied on the zero-initialized (hence defined in terms
of valgrind) mem map at the initialization time.
Change RosAlloc so that it does explicitly zeroes the entire mem map at
the initialization time and it does not rely on the zero-initialized of
the mem map.
Also, avoid explicitly changing the valgrind state in the
MemoryToolMallocSpace constructor, which happens after the allocator is
initialized because that may interfere with the allocator internal
3 files changed