在嵌入式系统中使用boost内存限制 [英] Using boost in embedded system with memory limitation

查看:545
本文介绍了在嵌入式系统中使用boost内存限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们使用C ++来开发的Windows CE 4在嵌入式系统上运行的应用程序。

We are using c++ to develop an application that runs in Windows CE 4 on an embedded system.

我们的一个约束是,通过应用程序使用的所有内存应在启动仅的分配。我们写了很多容器和算法只使用preallocated内存而不是分配新的之一。

One of our constraint is that all the memory used by the application shall be allocated during startup only. We wrote a lot of containers and algorithms that are using only preallocated memory instead of allocating new one.

你是否认为这是我们能够使用Boost库,而不是我们自己的容器中,这些条件?

Do you think it is possible for us to use the boost libraries instead of our own containers in these conditions?

任何意见和/或建议,欢迎!

Any comments and/or advice are welcomed!

非常感谢,

尼克

推荐答案

您可以编写自己的容器,它从一个固定大小的静态缓冲区分配分配器。根据容器的使用模式分配器可以是递增一个指针一样简单(例如,当您只在应用程序启动时插入的东西放入容器一次,不要连续添加/移除元素。)

You could write your own allocator for the container, which allocates from a fixed size static buffer. Depending on the usage patterns of the container the allocator could be as simple as incrementing a pointer (e.g. when you only insert stuff into the container once at app startup, and don't continuously add/remove elements.)

这篇关于在嵌入式系统中使用boost内存限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆