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
umm_heap/valloc: support valloc (LEGACY) #2906
Conversation
do you really need this obsolete api? |
Yes, we need it in memory api test(LTP). |
do you mean LTP tests valloc? it doesn't sound like a good reason to introduce it in nuttx. |
Not test valloc, some LTP testcase call valloc to allocate the memory.
If nobody call valloc, linker will eliminate the code from final binary. On the other hand, we have to modify LTP to remove valloc. |
ok. it (LTP as an app actually using valloc) sounds like a good reason to add it. |
Will you please Kconfig this and document it for what it is? |
Why would this go behind Kconfig it has zero cost if it is not used? |
Sure you can argue "shoot em all " and let the linker sort it out. :) I would do it so that the intent of the of why it was added is documented and left off and turned on for the project that wants to use it. If not it may end up C&P at litter that is not garbage collected. |
is it not enough with the comment before valloc? And it isn't good to mention LTP in a general function.
NuttX already contains so many Kconfig, and it's already impossible to test all combination now. If the tool can do the selection automatically, it's wrong to add Kconfig in this case, because:
Since valloc contained in a standalone file, even the oldest linker can remove the unused object files without problem. |
What comment? Did I miss it? Maybe add one, that labels it as
LOL... I was referring to documenting it in the Kconfig. --help - Something to the effect "This is an obsolete function that can be enabled to be used by some third partly libraries that require it."
Yes very true. You can say the same about a Beginner developer, new to NuttX, dealing with lots of functions that were added to to make the build work for a project that should not be used. and it not referenced anywhere in this project. It is a case of information overload. Unqualified information - leaves the user overwhelmed. If you qualify it it it can be ignored. I do see your point. I agree with it. Please add a comment and call it a done. |
Wouldn't this be more appropriate under mmh/mm_heap where all of the other memory-related APIs from stdlib.h are implemented? |
okay, i done in this PR. |
@davids5 and @patacongo can we merge this PR now? |
Did the OBSOLETE comment get added? |
Reference: https://pubs.opengroup.org/onlinepubs/7908799/xsh/valloc.html Change-Id: Ieb425a77b0a8d758956996d201223a0050ae4920 Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
Done! |
Summary
valloc has the same effect as malloc(), except that the allocated memory is aligned to a page boundary.
Reference:https://pubs.opengroup.org/onlinepubs/7908799/xsh/valloc.html
Impact
Testing
daily test