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

Is it possible to use ASN1C without dynamic memory allocation? #477

Open
amuroh opened this issue Jul 3, 2023 · 4 comments
Open

Is it possible to use ASN1C without dynamic memory allocation? #477

amuroh opened this issue Jul 3, 2023 · 4 comments

Comments

@amuroh
Copy link

amuroh commented Jul 3, 2023

Hi,

I'm working on a memory constrained platform and I can not use any calloc(), malloc() or free() function calls.

Is it possible to use asn1c generated code with only previously declared static buffers, never using dynamic memory allocation?

Thank you very much,

Álvaro

@kentkost
Copy link

I recommend you take a look at ASN1SCC.
It generates C and ADA code that exclusively work on the stack.
A limit of this means your ASN.1 grammar has to have SIZE contraints everywhere.

@amuroh
Copy link
Author

amuroh commented Jul 12, 2023

Thank you @kentkost, we know that library, but we discarded using it because we are looking for a library that allows us to use Class types and Extension Marker (...)

If ASN1C could work by passing pointers to static allocated buffers or even providing our own malloc() and free() functions doing that, it would be great. Is that feasible?

@kentkost
Copy link

I would say no. Basically the encoders that are generated by ASN1C use dynamic memory allocation. You'd basically have to rewrite each encoder and decoder.

@amuroh
Copy link
Author

amuroh commented Jul 12, 2023

Understood, thank you so much.

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