MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="4HONyEt7Xx" Content-Transfer-Encoding: 7bit Message-ID: <18381.50641.786735.609323@domain.hid> Date: Tue, 4 Mar 2008 22:57:37 +0100 In-Reply-To: <47CDB710.6030103@domain.hid> References: <47CDA626.4010604@domain.hid> <18381.44749.419005.112838@domain.hid> <47CDB710.6030103@domain.hid> From: Gilles Chanteperdrix Subject: Re: [Xenomai-help] How should rt_task_delete(NULL) be used? List-Id: Help regarding installation and common use of Xenomai List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anders Blomdell Cc: xenomai-help --4HONyEt7Xx Content-Type: text/plain; charset=us-ascii Content-Description: message body and .signature Content-Transfer-Encoding: 7bit Anders Blomdell wrote: > Gilles Chanteperdrix wrote: > > Anders Blomdell wrote: > > > Why does the following program grow it's VMSIZE? This is the output I get: > > > > > > [child = 0, 0] VmSize: 1912 kB > > > [child = 1, 1] VmSize: 1980 kB > > > [child = 2, 2] VmSize: 2048 kB > > > [child = 3, 3] VmSize: 2116 kB > > > [child = 4, 4] VmSize: 2184 kB > > > [child = 5, 5] VmSize: 2252 kB > > > [child = 6, 6] VmSize: 2320 kB > > > [child = 7, 7] VmSize: 2388 kB > > > [child = 8, 8] VmSize: 2456 kB > > > [child = 9, 9] VmSize: 2524 kB > > > [child = 10, 10] VmSize: 2592 kB > > > [child = 11, 11] VmSize: 2660 kB > > > [child = 12, 12] VmSize: 2728 kB > > > [child = 13, 13] VmSize: 2796 kB > > > [child = 14, 14] VmSize: 2864 kB > > > [child = 15, 15] VmSize: 2932 kB > > > [child = 16, 16] VmSize: 3000 kB > > > [child = 17, 17] VmSize: 3068 kB > > > [child = 18, 18] VmSize: 3136 kB > > > [child = 19, 19] VmSize: 3204 kB > > > > Could you dump /proc/self/maps at the beginning and the end, to see > > where the reserved memory comes from ? > > > > Sligtly modified program (being sloppy seems to be the better choice, just > returning without trying to cleanup self is cheaper, weird)... It looks like proper thread cleanup is needed to reclaim the threads stack. Could you try the attached patch ? -- Gilles Chanteperdrix. --4HONyEt7Xx Content-Type: text/plain Content-Disposition: inline; filename="xeno-native-cleanup.diff" Content-Transfer-Encoding: 7bit Index: src/skins/native/task.c =================================================================== --- src/skins/native/task.c (revision 3521) +++ src/skins/native/task.c (working copy) @@ -198,7 +198,8 @@ int rt_task_delete(RT_TASK *task) err = pthread_cancel((pthread_t)task->opaque2); if (err) return -err; - } + } else if (!task) + pthread_exit(NULL); err = XENOMAI_SKINCALL1(__native_muxid, __native_task_delete, task); if (err == -ESRCH) --4HONyEt7Xx--