Pular para o conteúdo principal
Knowledgebase
Home
Renesas Brasil - Knowledgebase

Is there a way to make frequent intervals perform faster?

Latest Updated:09/10/2007

Question:

When I executed malloc(), free() and new opereters iteratively at frequent intervals, performances became slower in these functions. Is there a way to make performances faster?

Answer:

Even though total size of the free space is enough, if they are fragmented into smaller parts by iterating memory allocation, performance speed becaomes slower. In this cace, it is difficult to obtain big area newly also. 

In order to avoid situations like please use heap area.

We also recommend you the followings.

(a) Reserve are in large size just after executing a program.

(b) Keep data area to be released in same size.

In addition to above, the haep are is total amount of the area allocated by the memory management library functions: calloc, malloc, realloc and new function.

Heap are is managed in 1024 bytes unit.

Please reserve heap area by refering a calculating formula below. 

HEAPSIZE = 1024 × n (n ≥1)

(Area allocated by the memory management library functions) + (Management area) ≤ HEAPSIZE

*Management area means area requires for function call. 4 bytes is required for each function call. 

Please refer to 9.2.1 Memory Allocation in your C/C++ Compiler, Assembler, Optimizing Linkage Editor User’s Manual.

Suitable Products
C/C++ Compiler Package for SuperH Family
C/C++ Compiler Package for H8SX, H8S, H8 Family