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

Fixed buffer size in senml_json_serialize limits handling of multiple resources #772

Open
sergioGras opened this issue May 3, 2024 · 1 comment

Comments

@sergioGras
Copy link

Description
The senml_json_serialize function uses a statically allocated buffer (uint8_t bufferJSON[PRV_JSON_BUFFER_SIZE];), which may not be sufficient for operations involving multiple resources or large data sets, for example reading an object with multiple instances.

Issue
If the serialized data exceeds the PRV_JSON_BUFFER_SIZE, serialization failures occur, affecting the ability of the protocol to efficiently handle larger or multiple resource transmissions.

Suggested Enhancement
Consider implementing dynamic buffer allocation or a more flexible buffer management strategy to accommodate varying payload sizes, enabling robust and scalable data management according to LwM2M specifications.

Would appreciate further insights or suggestions on this approach.

@LukasWoodtli
Copy link
Contributor

I suppose it was implemented that way because of the use of Wakaama in embedded systems.
It's often considered bad practice to dynamically allocate memory in embedded systems. Some of the reasons are memory fragmentation and out of memory problems. In some cases, dynamic memory is only allocated at startup to recognise memory problems early.

Generally we have some use of dynamic memory allocation in Wakaama. We should just use it sprasingly and with care.

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

2 participants