Boost logo

Boost Users :

From: Marc Ruiter (marc.ruiter_at_[hidden])
Date: 2008-06-03 17:15:53

Hi Andreas

> Hi Marc
>> I'm trying to convert a custom statemachine implementation in a
>> real-time
>> application to Boost.Statechart. The FAQ mentions that custom allocators
>> have to be provided for Event, StateMachine etc. in order to get
>> deterministic timing behaviour. I'm currently working on an allocator
>> which uses an internal preallocated memory pool. Now my question is
>> whether it is possible to determine how much memory i need to
>> preallocate
>> for the States and Events.
> Besides the obvious ones (storage for events & states, memory usage also
> depends on what features you use: event posting, history, etc.). It is
> theoretically possible to determine the exact memory requirements in
> advance
> but it's probably much easier to simply let the machine run through all
> possible states (e.g. with the unit tests you've written) and observe the
> amount of memory used. If that is not an option for you please let me
> know.

Many thanks for your reply. That is actually a feasible solution for the
long run, but at the moment I'm looking for something that allows me to
automatically calculate the memory needed by the states and events. I
think a reasonable upper limit for the states would be something like
maximum_nesting_level * maximum_state_size. Is there anyway I could
calculate this (or any other upper limit) automatically (i.e. not manually
in the code)?

I also wanted to ask about the event queue in state_machine. In my
statemachine events will be posted internally as well as from an external
source. Is there a way to force a certain limit on the number of events in
the queue in order to be able to preallocate the right amount of memory?

Thanks for your help,

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at