Using boost in embedded system with memory limitation

前端 未结 6 844
夕颜
夕颜 2021-01-04 19:01

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

One of our constraint is that all the memory used by the application shal

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-04 19:15

    I'm looking into this right now — I would like to use circular buffers, lock-free containers, and asynchronous I/O, and instead of allocating dynamic memory, I'd prefer to use memory pools.

    The biggest problem I've seen so far is that shared_ptr is used in a lot of places, with no easy way to replace it with intrusive_ptr. Since shared_ptr allocates dynamic memory to keep track of the reference count, I can't use it in an embedded system.

    Fixing this looks doable, but a lot of work — I have to expand the template specification of any class that contains a shared_ptr so that the specific type of shared-pointer can be changed to intrusive_ptr if desired. So now I have to consider how much work that'll be, versus how much work it'll be to write my own version of the Boost features I need. Not a pleasant place to be.

    I hope someone points out why I'm wrong about this.

提交回复
热议问题