Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why would we use a pre-allocated pool of list nodes for the observers? #367

Open
JensB-tech opened this issue Sep 4, 2021 · 0 comments
Open

Comments

@JensB-tech
Copy link

He says earlier (on p.46) in the observer chapter that you would usually use a dynamically sized collection for the observer pointers instead of a "dumb array", so that you don't have to use a compile-time constant for the max amount of observers a subject can have watching it.
But then later (on p.53), he says that in order to avoid dynamically allocating the list nodes you should use a pre-allocated pool of list nodes. This confuses me, aren't we back to the same problem we had earlier when we had a fixed array of observer pointers? With a pre-allocated pool, we have to decide on a maximum number of observers for not just one subject, but for the whole program. How is that sustainable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant