Skip to content

Commit 65f9fba

Browse files
committed
Add heap size limit
to solve #342 JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan [email protected] JerryScript-DCO-1.0-Signed-off-by: SaeHie Park [email protected]
1 parent d4bc645 commit 65f9fba

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ project (Jerry CXX C ASM)
8383

8484
set(EXTERNAL_LIBC_INTERFACE "UNDEFINED" CACHE STRING "Path to external libc include directory")
8585
set(EXTERNAL_LIBS_INTERFACE "UNDEFINED" CACHE STRING "Path to external libraries' include directory")
86+
set(EXTERNAL_MEM_HEAP_SIZE_KB "256" CACHE STRING "Size of memory heap, in kilobytes")
8687
else()
8788
message(FATAL_ERROR "Platform '${PLATFORM}' is not supported")
8889
endif()

jerry-core/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ project (JerryCore CXX C ASM)
8888
math(EXPR MEM_HEAP_AREA_SIZE_16K "16 * 1024")
8989
set(DEFINES_JERRY_MCU_STM32F4 CONFIG_MEM_HEAP_AREA_SIZE=${MEM_HEAP_AREA_SIZE_16K})
9090

91+
# External
92+
math(EXPR MEM_HEAP_AREA_SIZE_EXTERNAL "${EXTERNAL_MEM_HEAP_SIZE_KB} * 1024")
93+
set(DEFINES_JERRY_EXTERNAL CONFIG_MEM_HEAP_AREA_SIZE=${MEM_HEAP_AREA_SIZE_EXTERNAL})
94+
9195
# Include directories
9296
set(INCLUDE_CORE
9397
${CMAKE_SOURCE_DIR}/jerry-core

jerry-core/config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@
5353
*/
5454
#ifndef CONFIG_MEM_HEAP_AREA_SIZE
5555
# define CONFIG_MEM_HEAP_AREA_SIZE (256 * 1024)
56+
#elif CONFIG_MEM_HEAP_AREA_SIZE > (256 * 1024)
57+
# error "Currently, maximum 256 kilobytes heap size is supported"
5658
#endif /* !CONFIG_MEM_HEAP_AREA_SIZE */
5759

5860
/**

0 commit comments

Comments
 (0)