Re: [Emc-developers] malloc in hal modules, methods of memory allocation

2019-08-17 Thread Nicklas Karlsson
> I am working on a hal module that may need a variable amount of memory > depending on it's configuration. Is it acceptable to use malloc in a hal > module? Should I use hal_malloc or is that specifically for pins? > > Les First choice: Memory may be dynamically allocated within real time by u

Re: [Emc-developers] malloc in hal modules

2019-08-14 Thread Sebastian Kuzminsky
On 8/14/19 6:48 AM, Les Newell wrote: I am working on a hal module that may need a variable amount of memory depending on it's configuration. Is it acceptable to use malloc in a hal module? Should I use hal_malloc or is that specifically for pins? Memory management is different for realtime mo

Re: [Emc-developers] malloc in hal modules

2019-08-14 Thread Les Newell
Hi Andy, Thanks for looking into this. Looking at the kinematics modules I suspect malloc can only be used in user space modules. For example genserkins.c seems to use hal_malloc if RTAPI is defined and malloc if ULAPI is defined. I also see references to rtapi_kmalloc. hm2 seems to be especi

Re: [Emc-developers] malloc in hal modules

2019-08-14 Thread andy pugh
On Wed, 14 Aug 2019 at 15:08, Les Newell wrote: > I am working on a hal module that may need a variable amount of memory > depending on it's configuration. Is it acceptable to use malloc in a hal > module? Should I use hal_malloc or is that specifically for pins? As I understand it, hal_malloc

Re: [Emc-developers] malloc in hal modules

2019-08-14 Thread Les Newell
Further to this question, how do I go about deleting the memory at shutdown? I see a reference in the halcompile docs to EXTRA_CLEANUP but the docs aren't too clear on how I iterate through each loaded module to delete it's memory (if allocated). Les On 14/08/2019 13:48, Les Newell wrote: I a