diff --git a/port/linux/api-make-linux.sh b/port/linux/api-make-linux.sh old mode 100644 new mode 100755 diff --git a/port/linux/api-make-win10.sh b/port/linux/api-make-win10.sh old mode 100644 new mode 100755 diff --git a/port/linux/api-make.sh b/port/linux/api-make.sh old mode 100644 new mode 100755 diff --git a/port/linux/gtest.sh b/port/linux/gtest.sh old mode 100644 new mode 100755 diff --git a/port/linux/init.sh b/port/linux/init.sh old mode 100644 new mode 100755 diff --git a/port/linux/make.sh b/port/linux/make.sh old mode 100644 new mode 100755 diff --git a/port/linux/package/pikascript/rust-msc-latest-linux b/port/linux/package/pikascript/rust-msc-latest-linux old mode 100644 new mode 100755 diff --git a/port/linux/pull-core.sh b/port/linux/pull-core.sh old mode 100644 new mode 100755 diff --git a/port/linux/push-core.sh b/port/linux/push-core.sh old mode 100644 new mode 100755 diff --git a/port/linux/test-banchmark.sh b/port/linux/test-banchmark.sh old mode 100644 new mode 100755 diff --git a/port/linux/update-compiler.sh b/port/linux/update-compiler.sh old mode 100644 new mode 100755 diff --git a/src/dataMemory.c b/src/dataMemory.c index 11b81bb56..78da7ebef 100644 --- a/src/dataMemory.c +++ b/src/dataMemory.c @@ -33,7 +33,7 @@ PikaMemInfo pikaMemInfo = {0}; void* pikaMalloc(uint32_t size) { /* pika memory lock */ - while(__isLocked_pikaMemory()){ + while (__isLocked_pikaMemory()) { } pikaMemInfo.heapUsed += size; if (pikaMemInfo.heapUsedMax < pikaMemInfo.heapUsed) { @@ -53,8 +53,8 @@ void* pikaMalloc(uint32_t size) { void pikaFree(void* mem, uint32_t size) { /* pika memory lock */ - while(__isLocked_pikaMemory()){ - } + while (__isLocked_pikaMemory()) { + } __platformDisableIrqHandle(); __impl_pikaFree(mem, size); __platformEnableIrqHandle(); @@ -146,9 +146,11 @@ void* pool_malloc(Pool* pool, uint32_t size) { for (uint32_t block_index = pool->block_index_min_free; block_index < block_index_max; block_index++) { /* 8 bit is not free */ - if(0xFF == bitmap_getByte(pool->bitmap, block_index)){ -// block_index = aline_by(block_index, 8) - 1; -// continue; + uint8_t bitmap_byte = bitmap_getByte(pool->bitmap, block_index); + if (0xFF == bitmap_byte) { + block_index = 8 * (block_index / 8) + 7; + block_num_found = 0; + continue; } /* found a free block */ if (0 == bitmap_get(pool->bitmap, block_index)) { @@ -189,11 +191,11 @@ void pool_free(Pool* pool, void* mem, uint32_t size) { return; } -uint32_t aline_by(uint32_t size, uint32_t aline){ - if(size == 0){ +uint32_t aline_by(uint32_t size, uint32_t aline) { + if (size == 0) { return 0; } - return ((size - 1)/aline + 1) * aline; + return ((size - 1) / aline + 1) * aline; } BitMap bitmap_init(uint32_t size) {