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

mempool element and block size pathology #70

Open
JohnMcHugh opened this issue Oct 7, 2013 · 0 comments
Open

mempool element and block size pathology #70

JohnMcHugh opened this issue Oct 7, 2013 · 0 comments

Comments

@JohnMcHugh
Copy link

It appears to be possible to specify mempool elements that are larger than the blocks which should contain them.

The place where these come together is in the mempool creation routine cork_mempool_new_size_ex. At the very least, the problem could be diagnosed there, taking into account the need to provide both block and element headers. Possible solutions include:

  1. Modifying the documentation to call attention to the erroneous usage. This, alone, leaves open the possibility of difficult to diagnose segmentation faults at run time. It also requires exposing the block and element structures with their otherwise invisible header / link fields.
  2. Including a test in cork_mempool_new_size_ex that will abort the computation if the pathology occurs. If this is done, the diagnostic should specify the minimum block size required to hold a single element of the desired size.
  3. Allowing the code to adjust the block size, if necessary, so that a block will hold at least one element with the necessary header / link fields. Note that this might be extended so that a block will always hold an integral number of elements. It is not clear that this offers other than aesthetic benefits, although, a user naively specifying a block that is an integral multiple of the user's element size ensures a, possibly significant, waste of space due to the header / link space required.
  4. Introduce an incompatible change that replaces the block size specification with an element count specification. With this change, a default element count would replace the current default block size specification.
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