Replies: 7 comments 8 replies
-
Thank you for opening this discussion. Regarding the #2171 (comment), I made a new branch using If you're happy with this, I'll send you a new PR :)
In addition to the MMAP, I want Prism to be able to replace functions relating to heap like My first idea to replace /* defines.h */
#ifdef USE_CUSTOM_ALLOC
#include "custom_alloc.h"
#else
# define MALLOC malloc
# define CALLOC calloc
# define REALLOC realloc
# define FREE free
#endif And replace Then the user can write their own /* custom_alloc.h */
#define MALLOC my_malloc
#define CALLOC my_calloc
#define REALLOC my_realloc
#define FREE my_free Although I am OK with this simple solution, mruby has a more flexible way that What do you think? |
Beta Was this translation helpful? Give feedback.
-
Hey @hasumikin — The As for the memory functions, I think that could work in the short-term, but in the long-term I'd prefer that we allow users to define memory functions on the parser itself, much like we have for mruby. But until that time, I'd be okay with a workaround like the one you suggest. The only thing I would do is prefix it with |
Beta Was this translation helpful? Give feedback.
-
(Created a PR but CI fails. Trying to figure it out...) |
Beta Was this translation helpful? Give feedback.
-
@kddnewton I think this works enough.
What do you think? |
Beta Was this translation helpful? Give feedback.
-
After merging the PR #2542, I think we may better have a static check of detecting usage of malloc/calloc/realloc/free in |
Beta Was this translation helpful? Give feedback.
-
I want to discuss restricting encodings in terms of reducing the code (ROM) size.
(Naming PRISM_ONLY_xxx is just a casual idea) |
Beta Was this translation helpful? Give feedback.
-
Going to close for now. Please open if there are any other ideas for reducing the size! |
Beta Was this translation helpful? Give feedback.
-
Following up on @hasumikin's #2171 PR, this discussion is around how we want to support embedded devices, particularly ones without a file system.
If I understand correctly, the only real changes we would need to support are in
pm_string.{c,h}
, which performs all of the IO to set up the string so that the parser can callpm_string_source
andpm_string_length
. Everything else depends only on standard C99 libraries with no IO.@hasumikin what else can we do to support this work?
Beta Was this translation helpful? Give feedback.
All reactions