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

Add an assert for max heap size #60

Closed
wants to merge 1 commit into from

Conversation

mkacperek
Copy link

No description provided.

@rhempel
Copy link
Owner

rhempel commented Dec 24, 2021

The only problem I have with this is the call to assert() which can cause problems in some restrictive compile environments that do not support assert. I would propose two options:

  1. Silently truncate the max heap size to the calculated limit
  2. Silently create a minimal heap that is guaranteed to fail on the first allocation
  3. Add user macros to allow behavior to be defined

The user macros could be:

UMM_HANG_IF_SIZE_TOO_BIG
UMM_TRUNCATE_IF_SIZE_TOO_BIG
UMM_MINMIZE_IF_SIZE_TOO_BIG

Honestly I would prefer the solution of making the note about maximum heap size a more visible warning in the docs - possibly verifying at compile time,

@rhempel
Copy link
Owner

rhempel commented Jan 24, 2022

I've made a change in the most recent release that handles this case (sort of) if you request a block bigger than the number of blocks, then we fail the allocation.
I think what I'll do here is take @evanrichters input and add a big comment to the init functing - and update the main docs with a more clear admonition

@rhempel rhempel closed this Jan 24, 2022
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

Successfully merging this pull request may close these issues.

2 participants