History log of /haiku/src/system/kernel/guarded_heap.cpp
Revision Date Author Comments
# 70e8eacb 19-Jun-2023 Augustin Cavalier <waddlesplash@gmail.com>

kernel: Implement realloc_etc and make use of it.


# 4e16be4f 25-Apr-2022 Augustin Cavalier <waddlesplash@gmail.com>

kernel: Do not invoke memalign with 0 as the alignment argument.

The memalign() function has special semantics for its arguments
even when -fno-builtin is enabled, it seems (that may be a problem
on Clang's part, however.) The alloc_align attribute, which we apply
to the memalign_etc function, does not seem to have the same problems;
at least its documentation at GCC gives no indication that 0 is not a
legal value to pass.

Change-Id: Ie5ba090b924ac3577775165d20f11f9696be97f3


# 3ff5a879 13-Jun-2020 Michael Lotz <mmlr@mlotz.ch>

kernel/guarded_heap: Add stack traces to allocations command.

This allows dumping the allocation stack traces in the more powerful
allocations command with the optional "trace" argument. The stack trace
could previously only be dumped manually by inspecting individual
guarded heap pages.


# 5d05694a 23-Apr-2015 Michael Lotz <mmlr@mlotz.ch>

kernel guarded heap: Implement allocations debugger command.

It can be used to dump the current heap allocations with their details
and stack traces if enabled.


# 453ee84e 23-Apr-2015 Michael Lotz <mmlr@mlotz.ch>

kernel guarded heap: Also store team id for allocations.


# db214549 12-Nov-2014 Adrien Destugues <pulkomandy@gmail.com>

guarded_heap: fix build (volatile + atomic ops)

Unfortunately, the package manager uses more kernel memory and it's not
possible to boot to the desktop with the guarded heap anymore.


# 5e5eef0b 06-Dec-2011 Michael Lotz <mmlr@mlotz.ch>

Fix the page need calculation, it was possibly off by one.


# 336967aa 04-Dec-2011 Michael Lotz <mmlr@mlotz.ch>

Add more debugger commands to closer inspect the guarded heap.


# 4a7b4820 04-Dec-2011 Michael Lotz <mmlr@mlotz.ch>

Try smaller sizes if creating an area failed.

Depending on the use case the grow size may be too large to fit into
address space holes. Instead of failing try with smaller sizes until
it either worked or doesn't make sense anymore (< 1MB).


# 01eb710a 04-Dec-2011 Michael Lotz <mmlr@mlotz.ch>

Use a free list to make the guarded heap perform less horribly.

Pages that are freed are added to the tail of the list while allocation
candidates are taken from the head. Therefore pages that have been free
the longest are preferred, making immediate re-use less likely.

Also avoid looking for pages if the free count already tells that the
allocation can't be fulfilled.


# 5cbe06f4 04-Dec-2011 Michael Lotz <mmlr@mlotz.ch>

Allow replacing the object cache with the guarded heap.

This allows to use the debug features of the guarded heap also on
allocations made through the object cache API. This is obivously
horrible for performance and uses up huge amounts of memory, so the
initial and grow sizes are adjusted accordingly.

Note that this is a rather simple hack, using the object_cache pointer
to transport the allocation size. The alignment is neglected completely.


# 390a6e2e 03-Dec-2011 Michael Lotz <mmlr@mlotz.ch>

Add support for optional inline stack traces in guarded heap.


# 1fe24d0c 03-Dec-2011 Michael Lotz <mmlr@mlotz.ch>

Add heap with guard pages to detect out of bound reads/writes.

This is a very simple heap implementation that allocates memory so that
the end of each allocation always coincides with a page end and is
followed by a guard page which is marked non-present. Out of bounds
access (both read and write) therefore cause a crash (unhandled page
fault).

Note that this allocator is neither speed nor space efficient, indeed it
wastes huge amounts of pages and address space so it is quite easy to
hit limits. It is intended as a pure debug feature.


# 5d05694ad6eaa3129a739f55232ec11bb57ecd31 23-Apr-2015 Michael Lotz <mmlr@mlotz.ch>

kernel guarded heap: Implement allocations debugger command.

It can be used to dump the current heap allocations with their details
and stack traces if enabled.


# 453ee84e23fc2ec9c09459454286fffa3466567e 23-Apr-2015 Michael Lotz <mmlr@mlotz.ch>

kernel guarded heap: Also store team id for allocations.


# db214549c56364fd6e9ccd09f3680921244788e9 12-Nov-2014 Adrien Destugues <pulkomandy@gmail.com>

guarded_heap: fix build (volatile + atomic ops)

Unfortunately, the package manager uses more kernel memory and it's not
possible to boot to the desktop with the guarded heap anymore.


# 5e5eef0b5bf3d6e88a3c5d1cde24d254209a88b6 06-Dec-2011 Michael Lotz <mmlr@mlotz.ch>

Fix the page need calculation, it was possibly off by one.


# 336967aafdc50b8a46e50a20d596beb8e9f65613 04-Dec-2011 Michael Lotz <mmlr@mlotz.ch>

Add more debugger commands to closer inspect the guarded heap.


# 4a7b48203e5597f3830ecb8e68a26b157ba97e5b 04-Dec-2011 Michael Lotz <mmlr@mlotz.ch>

Try smaller sizes if creating an area failed.

Depending on the use case the grow size may be too large to fit into
address space holes. Instead of failing try with smaller sizes until
it either worked or doesn't make sense anymore (< 1MB).


# 01eb710a9153406a2ce2be08c00a01d56f7737e3 04-Dec-2011 Michael Lotz <mmlr@mlotz.ch>

Use a free list to make the guarded heap perform less horribly.

Pages that are freed are added to the tail of the list while allocation
candidates are taken from the head. Therefore pages that have been free
the longest are preferred, making immediate re-use less likely.

Also avoid looking for pages if the free count already tells that the
allocation can't be fulfilled.


# 5cbe06f482858c8b79671927e887ab08375a721c 04-Dec-2011 Michael Lotz <mmlr@mlotz.ch>

Allow replacing the object cache with the guarded heap.

This allows to use the debug features of the guarded heap also on
allocations made through the object cache API. This is obivously
horrible for performance and uses up huge amounts of memory, so the
initial and grow sizes are adjusted accordingly.

Note that this is a rather simple hack, using the object_cache pointer
to transport the allocation size. The alignment is neglected completely.


# 390a6e2e0238112a68521b3b9210e1dbf98f9d47 03-Dec-2011 Michael Lotz <mmlr@mlotz.ch>

Add support for optional inline stack traces in guarded heap.


# 1fe24d0cd0b547a771c00f6fca8f50ba6ca2fb2c 03-Dec-2011 Michael Lotz <mmlr@mlotz.ch>

Add heap with guard pages to detect out of bound reads/writes.

This is a very simple heap implementation that allocates memory so that
the end of each allocation always coincides with a page end and is
followed by a guard page which is marked non-present. Out of bounds
access (both read and write) therefore cause a crash (unhandled page
fault).

Note that this allocator is neither speed nor space efficient, indeed it
wastes huge amounts of pages and address space so it is quite easy to
hit limits. It is intended as a pure debug feature.