English 中文(简体)
Micrim μC/OS-III RTOS 免费分配
原标题:Allocation and Free in Micriμm μC/OS-III RTOS

我们正在使用的μC/OS-III RTOS 和RX62N的Renesas。

We built a system where we have to dynamicly alloc and free data. We found out the functions malloc() and free() are not working well with the RTOS. However the RTOS has a custom function for this; the Mem_HeapAlloc() function. This function allocates some memory of the RTOS made heap . Problem is that it does not have a free function, probably because everything goes into a heap pool.

在 RTOS 中, 也可以建立一个集合体。 这个集合体的问题在于所有封存区块的大小必须相同。 由于我们正在分配和释放不同的大小, 这对我们来说不是一个好的解决办法 。

We found a document which describes the memory RTOS functions HERE Chapter 4 describes the functions.

有人知道我们怎样才能解决这个问题吗?

我们所准备的一些解决办法

  • Make all the blocks sizes the same as the biggest allocation. We have a lot of overhead since the smallest and biggest allocation differ a lot.
  • Don t do a free. This is no solution, there will be a memory leak.

希望有人能帮我们 如果有什么不清楚 请问我

提前感谢

问题回答
  • you can allocate your objects in multiples of block sizes.

你仍然会有一些内部分裂,因此你无法充分利用现有空间。

使用记忆池,你仍然有优势

  • 内存库允许用持续执行时间( 不破碎) 来分配内存。 在一个池中, 数千个天体的内存释放仅仅是一个操作, 如果使用中间点来分配每个天体的内存, 则不是一个一个操作 。

  • 内存库可按树级结构分组,适合诸如循环和循环等特别编程结构。

  • 固定规模区块内存池不需要存储每项分配的分配元数据,说明分配区块大小等特点,特别是对于小额分配而言,这可节省大量空间。





相关问题
Fastest method for running a binary search on a file in C?

For example, let s say I want to find a particular word or number in a file. The contents are in sorted order (obviously). Since I want to run a binary search on the file, it seems like a real waste ...

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

Tips for debugging a made-for-linux application on windows?

I m trying to find the source of a bug I have found in an open-source application. I have managed to get a build up and running on my Windows machine, but I m having trouble finding the spot in the ...

Trying to split by two delimiters and it doesn t work - C

I wrote below code to readin line by line from stdin ex. city=Boston;city=New York;city=Chicago and then split each line by ; delimiter and print each record. Then in yet another loop I try to ...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

Encoding, decoding an integer to a char array

Please note that this is not homework and i did search before starting this new thread. I got Store an int in a char array? I was looking for an answer but didn t get any satisfactory answer in the ...

热门标签