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

allocating large chunk of bytes #348

Open
failfmi opened this issue Jan 30, 2024 · 1 comment
Open

allocating large chunk of bytes #348

failfmi opened this issue Jan 30, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@failfmi
Copy link
Collaborator

failfmi commented Jan 30, 2024

While trying to benchmark the runtime with 10_000 System.remark extrinsics in Execute_block, the following error occurs:

failed to allocate: allocating: bumping: cannot grow linear memory: from 4096 pages to 8192 pages

Even if we increase the wazero instance wasm pages to more (8192, or even 16384), a new error occurs:

running runtime function: order from size: requested allocation too large, requested 67108864, max possible allocations: 33554432 (recovered by wazero)

It seems that it tries to allocate a big chunk, which is more than the maximum allowed (33554432).

Most probably GC related.

@failfmi failfmi added the bug Something isn't working label Jan 30, 2024
@failfmi failfmi moved this from 🆕 New to 📋 Backlog in Gosemble - Polkadot Runtimes Jan 30, 2024
@radkomih
Copy link
Collaborator

radkomih commented Jan 30, 2024

todo

  1. test multiple calls to a simple runtime function that heap allocates and frees memory (trigger the gc manually):
  • fixed a gc issue when opt levels is 0:
...
.runtime.alloc(i32,i32,i32) i32
.runtime.alloc(i32,i32,i32) i32
.runtime.alloc(i32,i32,i32) i32
.runtime.hashmapMake(i32,i32,i32,i32,i32) i32
.github.com/LimeChain/gosemble/primitives/types.BuildMetadataTypesIdsMap(i32) i32
.(*github.com/LimeChain/gosemble/primitives/types.MetadataTypeGenerator).ClearMetadata(i32,i32)
  • single byte - the gc works as expected
  • slices, maps, structs -
  1. test the metadata runtime function:
  • it appears that there is a memory issue, it might not be an actual memory leak, but a global that is constantly adding stuff in memory
  • use an older commit, before the metadata refactor - it appears to be working fine
  • the "goscale" codec could be contributing to the problem, since the second error appears similar to a previous one: hitting the max possible allocation size when U8 encoding with the custom gc

@radkomih radkomih self-assigned this Feb 5, 2024
@radkomih radkomih moved this from 📋 Backlog to 🏗 In progress in Gosemble - Polkadot Runtimes Feb 5, 2024
@radkomih radkomih moved this from 🏗 In progress to 🔖 On hold in Gosemble - Polkadot Runtimes Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 🔖 On hold
Development

No branches or pull requests

2 participants