Commit Graph

17 Commits

Author SHA1 Message Date
vivek.j
322ff67050 [lib][miniheap] fix: modify the assert condition in miniheap
For LK_DEBUGLEVEL > 1
> alloc_struct_begin_size: 24
> free_heap_chunk_size: 24

size: max(alloc_struct_begin_size, free_heap_chunk_size)

But when freeing the chunk, allocated size is expected to be
greater than size of free_heap_chunk struct.
It contradicts its own code.
So add >= instead of > to maintain the integrity between
allocation and freeing of memory chunk.

Signed-off-by: vivek.j <vivek.j@samsung.com>
2025-04-05 00:25:54 -07:00
Travis Geiselbrecht
5a3d51e3e7 [assert] fix up a few places broken at DEBUG=0 after recent assert changes
Forgot to test at DEBUG=0. Both of these are basically cases where
the new DEBUG_ASSERT_COND should be used, since the default DEBUG_ASSERT
will now always emit code that gets cleaned up in the optimizer.
2021-04-02 20:16:53 -07:00
Travis Geiselbrecht
1b36390a39 [heap][miniheap] fix assert when miniheap is initialized with a non 8 byte aligned ptr on 64bit cpu 2020-01-16 23:38:38 -08:00
Travis Geiselbrecht
cba9e47987 [license] replace the longer full MIT license with a shorter one
Used scripts/replacelic. Everything seems to build fine.
2019-07-05 17:22:23 -07:00
Travis Geiselbrecht
d8fa82cb91 [formatting] run everything through codestyle
Almost nothing changes here except moving braces to the same line as the
function declaration. Everything else is largely whitespace changes and
a few dangling files with tab indents.

See scripts/codestyle
2019-06-19 21:02:24 -07:00
Travis Geiselbrecht
1b7a28efb8 [include][lk] fixup lk/ include path move 2019-06-19 19:46:11 -07:00
Erik Corry
6d0122b98e [heap] Add API used by Dartino to get arena list 2016-03-23 21:22:39 +01:00
Gurjant Kalsi
52f4728c44 [magic][constants] Convert all of LK's multichar character kernel magic constants to hex. 2016-02-09 15:02:05 -08:00
Erik Corry
12868bf6c0 [lib][heap] Add Cmpctmalloc as an alternative malloc implementation
From scratch simple binning heap. Complexity wise in the middle
between miniheap and dlmalloc. Generally much faster than miniheap
with a small amount of memory overhead. Performs similarly to
dlmalloc.
2015-11-05 16:47:03 -08:00
Travis Geiselbrecht
619f916716 [lib][miniheap] add trim function
Add miniheap trim routine, which will attempt to free pages back to the
page allocator when called. Currently not called by anyone, unless
MINIHEAP_AUTOTRIM is set.
2015-10-22 13:28:18 -07:00
Travis Geiselbrecht
1485131d00 [lib][heap] refactor top level malloc/free into lib/heap
Flatten a level by moving malloc/free/new and friends into lib/heap.
Punch realloc and a few others directly through into the underlying
heap implementation. Remove heap_alloc and heap_free entirely.
2015-10-19 14:57:51 -07:00
Travis Geiselbrecht
1c6e80f171 [lib][heap] factor out the heap_grow api and have miniheap & dlmalloc call page_alloc directly 2015-10-19 14:02:30 -07:00
Travis Geiselbrecht
fab92f3179 [lib][heap] have novm initialize itself, rename novm 'heap' to 'arena' to be less confusing 2015-10-15 18:15:45 -07:00
Travis Geiselbrecht
e9a6bd0ea1 WIP get the heap code pointing at the new page allocator 2015-10-15 16:52:02 -07:00
Travis Geiselbrecht
6bd49c3917 [lib][heap] more WIP on heap stuffs 2015-10-15 14:53:00 -07:00
Travis Geiselbrecht
1193213dfd WIP get dlmalloc working with a mmap() style allocator out of the heap wrapper 2015-10-14 19:56:24 -07:00
Travis Geiselbrecht
30bfd752b1 [lib][heap] first stab at breaking the heap into a generic heap layer and a specific implementation
The old implementation is now called 'miniheap'
2015-10-14 18:14:30 -07:00