Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • A ArduinoJson
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 24
    • Issues 24
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Benoît Blanchon
  • ArduinoJson
  • Issues
  • #1074
Closed
Open
Issue created Aug 18, 2019 by Simon Arlott@nomis

Feature request: on demand heap allocation

I'm storing configuration in SPIFFS and so I have to size the DynamicJsonDocument large enough that it won't unexpectedly fail to read/write the whole configuration file.

The problem I have is that this allocation is then always quite large and made in one request from the heap, which significantly fragments the heap. I'd like it to make additional allocations as required from the heap up to a specified limit instead. I don't need it to free the memory until the document is destroyed.

I know you've discounted this on the basis that it causes more heap fragmentation but I disagree. The fragmentation of the heap is affected by the size of allocations being made. By always making one big allocation (5% of total memory) there's a significant risk that once freed the space occupied by that allocation will be reused by smaller allocations and a contiguous block of that size will no longer be available from the heap.

Assignee
Assign to
Time tracking