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] Trying to allocate from a full arena #85

Closed
mratsim opened this issue Dec 31, 2019 · 0 comments · Fixed by #138
Closed

[Mempool] Trying to allocate from a full arena #85

mratsim opened this issue Dec 31, 2019 · 0 comments · Fixed by #138
Labels
bug 🪲 Something isn't working memory 💫

Comments

@mratsim
Copy link
Owner

mratsim commented Dec 31, 2019

https://travis-ci.com/mratsim/weave/jobs/271436702#L414-L426

========================================================================================

Running [] weave/memory/memory_pools.nim

========================================================================================

Single-threaded: System alloc for 100 blocks: 0.7871 s

Single-threaded: Pool   alloc for 100 blocks: 0.4178 s

Multi-threaded: System alloc: 0.0178 s

fatal.nim(39)            sysFatal

Error: unhandled exception: contracts.nim(86, 15) `

arena.meta.used < arena.blocks.len` 

    Contract violated for pre-condition at memory_pools.nim:359

        arena.meta.used < arena.blocks.len

    The following values are contrary to expectations:

        62 < 62  [Worker N/A]

 [AssertionError]

func allocBlock(arena: var Arena): ptr MemBlock {.inline.} =
## Allocate from an arena
preCondition: not arena.meta.free.isNil
preCondition: arena.meta.used < arena.blocks.len
arena.meta.used += 1
result = arena.meta.free
unpoisonMemRegion(result, WV_MemBlockSize)
# The following acts as prefetching for the block that we are returning as well
arena.meta.free = cast[ptr MemBlock](result.next.load(moRelaxed))
postCondition: arena.meta.used in 0 .. arena.blocks.len

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working memory 💫
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant