Re: [Xenomai] [xenomai]:heap memory management
super clear Philippe Thanks again for your help - Mail original - De: "Philippe Gerum" À: "pierre roumagnac" Cc: xenomai@xenomai.org Envoyé: Lundi 17 Octobre 2016 09:37:43 Objet: Re: [Xenomai] [xenomai]:heap memory management On 10/17/2016 08:44 AM, pierre.roumag...@free.fr wrote: > For my culture can someone explain me (or provide doc) the difference between > the memory pool create with --mem_pool_size and the > rt_heap_create api of alchemy? > http://xenomai.org/documentation/xenomai-3/html/xeno3prm/group__alchemy__heap.html#ga1d19ad24dc9f94b969aa0f574170bdc4. With Xenomai 3, any application process has access to a main memory pool, whose size can be set explicitly using --mem-pool-size, 1Mb by default. The Xenomai libraries allocate the dynamic memory they need from this main pool, which can be shared between multiple processes if you built the Xenomai code stack with the --enable-pshared option set. This allows multi-process applications to share real-time objects such as tasks, sema4, queues, heaps and so on. Applications using the alchemy API may call rt_heap_create() to initialize specific memory heaps for their own usage, whose memory is pulled from the main pool; this way, such heaps inherit the shared/private property of the main pool memory, depending on whether --enable-pshared was given to the configure script. Bottom line is that --enable-pshared should be set only for applications composed of multiple concurrent processes which must share data and/or real-time constructs; this feature should be left disabled otherwise. See the command line options for any Xenomai 3 application: http://xenomai.org/2015/05/application-setup-and-init/#Standard_Xenomai_command_line_options -- Philippe. ___ Xenomai mailing list Xenomai@xenomai.org https://xenomai.org/mailman/listinfo/xenomai
Re: [Xenomai] [xenomai]:heap memory management
On 10/17/2016 08:44 AM, pierre.roumag...@free.fr wrote: > For my culture can someone explain me (or provide doc) the difference between > the memory pool create with --mem_pool_size and the > rt_heap_create api of alchemy? > http://xenomai.org/documentation/xenomai-3/html/xeno3prm/group__alchemy__heap.html#ga1d19ad24dc9f94b969aa0f574170bdc4. With Xenomai 3, any application process has access to a main memory pool, whose size can be set explicitly using --mem-pool-size, 1Mb by default. The Xenomai libraries allocate the dynamic memory they need from this main pool, which can be shared between multiple processes if you built the Xenomai code stack with the --enable-pshared option set. This allows multi-process applications to share real-time objects such as tasks, sema4, queues, heaps and so on. Applications using the alchemy API may call rt_heap_create() to initialize specific memory heaps for their own usage, whose memory is pulled from the main pool; this way, such heaps inherit the shared/private property of the main pool memory, depending on whether --enable-pshared was given to the configure script. Bottom line is that --enable-pshared should be set only for applications composed of multiple concurrent processes which must share data and/or real-time constructs; this feature should be left disabled otherwise. See the command line options for any Xenomai 3 application: http://xenomai.org/2015/05/application-setup-and-init/#Standard_Xenomai_command_line_options -- Philippe. ___ Xenomai mailing list Xenomai@xenomai.org https://xenomai.org/mailman/listinfo/xenomai
Re: [Xenomai] [xenomai]:heap memory management
For my culture can someone explain me (or provide doc) the difference between the memory pool create with --mem_pool_size and the rt_heap_create api of alchemy? http://xenomai.org/documentation/xenomai-3/html/xeno3prm/group__alchemy__heap.html#ga1d19ad24dc9f94b969aa0f574170bdc4. Anyway i have set a manual erase of share memory, it looks likes working. Thanks Philippe for your explanation , really helpfull. PR - Mail original - De: "Philippe Gerum" À: "pierre roumagnac" , xenomai@xenomai.org Envoyé: Samedi 15 Octobre 2016 15:54:46 Objet: Re: [Xenomai] [xenomai]:heap memory management On 10/14/2016 11:45 AM, pierre.roumag...@free.fr wrote: > Hello > > I am currently working on a project running with xenomai 3.0.3 and using > alchemy skin. > My context : > - i need to use several large size queue using rt_queue_create (more than > 1Mbytes each) > - rt_queue_create does not work if i do not set --mem-pool-size option (we > use 256M value) > > My problem: > even if i generate a empty application: > int main(int argc,char**argv) > { >return 0; > } > my computer free memory drop of 256 MBytes at each application run which is > really bothersome when debbuging. > > Since i do not need shared memory, i have tried to used rt_heap_create / > rt_heap_delete inside my application. > But with this solution i cannot create a heap more than 1MBytes which is not > sufficient for my case. > > My question is : > is there a mean to release shared heap memory ? > or may be i do not correctly use rt_queue_create? There seem to be multiple aspects in the issue you describe: - heap sizes are limited to 2Gb, not 1Mb. 1Mb is the default size of the memory pool when not specified on the command line via --mem_pool_size; you could use the trick below to change this value: http://xenomai.org/2015/05/application-setup-and-init/#changing-default-tunable-value - the fact that your memory pool does not disappear on exit of your application can only happen in shared mode (--enable-pshared), in that case the shared pool lives in /dev/shm, consuming pure RAM. The heap may be left over if your application exits ungracefully and no support for shared registry is present (--disable-registry). In that case, the atexit() hook cannot run to clean up the heap, and the registry daemon won't be there to do this housekeeping work either. A solution for this situation would be running some out of line cleanup of /dev/shm before starting an application (maybe from within the application itself). -- Philippe. ___ Xenomai mailing list Xenomai@xenomai.org https://xenomai.org/mailman/listinfo/xenomai
Re: [Xenomai] [xenomai]:heap memory management
On 10/14/2016 11:45 AM, pierre.roumag...@free.fr wrote: > Hello > > I am currently working on a project running with xenomai 3.0.3 and using > alchemy skin. > My context : > - i need to use several large size queue using rt_queue_create (more than > 1Mbytes each) > - rt_queue_create does not work if i do not set --mem-pool-size option (we > use 256M value) > > My problem: > even if i generate a empty application: > int main(int argc,char**argv) > { >return 0; > } > my computer free memory drop of 256 MBytes at each application run which is > really bothersome when debbuging. > > Since i do not need shared memory, i have tried to used rt_heap_create / > rt_heap_delete inside my application. > But with this solution i cannot create a heap more than 1MBytes which is not > sufficient for my case. > > My question is : > is there a mean to release shared heap memory ? > or may be i do not correctly use rt_queue_create? There seem to be multiple aspects in the issue you describe: - heap sizes are limited to 2Gb, not 1Mb. 1Mb is the default size of the memory pool when not specified on the command line via --mem_pool_size; you could use the trick below to change this value: http://xenomai.org/2015/05/application-setup-and-init/#changing-default-tunable-value - the fact that your memory pool does not disappear on exit of your application can only happen in shared mode (--enable-pshared), in that case the shared pool lives in /dev/shm, consuming pure RAM. The heap may be left over if your application exits ungracefully and no support for shared registry is present (--disable-registry). In that case, the atexit() hook cannot run to clean up the heap, and the registry daemon won't be there to do this housekeeping work either. A solution for this situation would be running some out of line cleanup of /dev/shm before starting an application (maybe from within the application itself). -- Philippe. ___ Xenomai mailing list Xenomai@xenomai.org https://xenomai.org/mailman/listinfo/xenomai
[Xenomai] [xenomai]:heap memory management
Hello I am currently working on a project running with xenomai 3.0.3 and using alchemy skin. My context : - i need to use several large size queue using rt_queue_create (more than 1Mbytes each) - rt_queue_create does not work if i do not set --mem-pool-size option (we use 256M value) My problem: even if i generate a empty application: int main(int argc,char**argv) { return 0; } my computer free memory drop of 256 MBytes at each application run which is really bothersome when debbuging. Since i do not need shared memory, i have tried to used rt_heap_create / rt_heap_delete inside my application. But with this solution i cannot create a heap more than 1MBytes which is not sufficient for my case. My question is : is there a mean to release shared heap memory ? or may be i do not correctly use rt_queue_create? Thanks in advance for helps Regards PR ___ Xenomai mailing list Xenomai@xenomai.org https://xenomai.org/mailman/listinfo/xenomai