bsd: avoid #define malloc() when possible

bsd uses a 3-argument variant of malloc() instead of the standard single-
argument malloc().  This causes problems when including standard headers
along with bsd headers.

Fix by using a function overload instead.  A #define is only used in C code.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
memory: allow using debug allocator in parallel with standard allocator

Minor changes, allowing dbg::malloc() to be used in parallel with ::malloc().
This allows use-after-free debugging when the misbehaving type is known or
suspected.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
mempool: fix page_range_allocator::_bitmap resize

When resizing a dynamic_bitset some memory may be freed. In such case it is
not safe to attempt to merge unallocated block since the bitmap is in
undefined state. Instead, the memory free is deferred to a moment when the
resize is done and bitmap is reinitialized with up to date values.

page_range_allocator::_bitmap uses now custom allocator to get rid of
numerous checks agains _nobitmap in allocation and deallocation code.

Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Revert "Revert "mempool: use new page range allocator""

This reverts commit 0ff46442658062554221fc22f7bf2225b2f9b4b0.

Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
memory: debug allocator helper

Add a helper template that defines the appropriate new/delete operators for
the debug allocator.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Merge branch dbg-alloc

Small debug allocator improvements.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>