We have a class My_list that has a list of pointers to Abstract_things. To optimize memory usage, all derivative things use a single memory pool, which is set using the stereotype "new and remote". To correctly allocate the pool during application initialization, the builder finds out which Thing is the largest, and on the basis of this allocates the pool.
The design dilemma is that if a new thing is added to the model (represented by red Thing_4), the developer must know in order to go to Builder to configure the logic. I noticed that it was quite difficult for our team to remember this (about half of our Things discussed in Builder). I am very concerned that future generations will miss this.
My question is how can I improve this? It would be great if all this max_size property was automatically processed during the creation of the Thing_4 class. I can’t think about it.
Note. By reviewing my photo, I understand that there is a mistake. The last line in the code field should read Abstract_thing :: set_max_pool_size (max_size, max_number).
Edit: I can't figure out how to display the image. Everything looks good in the preview window, but when it is published it is not. Any help?
Edit: To give a little more background, this is part of the design of an embedded application in a security-critical system. We are allowed to allocate memory from the heap during application initialization, but after exiting this phase of NO initialization, dynamic memory may be allocated. Attempting to do this causes the application to crash. Therefore, we program the largest sizes and the maximum number of copies that we use. Having one pool that contains enough space for all derived objects is the best approach to using the pool for each derived object.
alt text http://img262.imageshack.us/img262/4470/designproblemof1.png
source
share