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
But I would have expecte dthe size to remain constant (API docs says: "Terminate
a task and release all the real-time kernel resources it currently holds." ...
"If task is NULL, the current task is deleted.")
Versions used are:
# uname -r ; cat /proc/xenomai/version
2.6.24.3-ipipe
2.4.2
#include <sys/mman.h>
#include <native/cond.h>
#include <native/mutex.h>
#include <native/task.h>
#include <native/timer.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
static void child(void *arg)
{
int n = (int)arg;
printf("[child = %2d", n);
fflush(stdout);
rt_task_delete(NULL);
}
int main(int argc, char *argv[])
{
int i;
RT_TASK task_main;
RT_TASK task;
mlockall(MCL_CURRENT|MCL_FUTURE);
rt_task_shadow(&task_main, "main", 1, T_FPU);
for (i = 0 ; i < 20 ; i++) {
if (rt_task_create(&task, NULL, 0, 1, 0)) {
fprintf(stderr, "Failed to create task\n");
exit(1);
}
if (rt_task_start(&task, &child, (void*)i)) {
fprintf(stderr, "Failed to start task\n");
exit(1);
}
rt_task_sleep(1000000000L);
{
int fd;
char *p1 = NULL, *p2 = NULL;
char buf[4000];
fd = open("/proc/self/status", O_RDONLY);
if (read(fd, buf, 4000) > 0) {
p1 = strstr(buf, "VmSize");
if (p1) { p2 = strstr(p1, "\n"); }
if (p1 && p2) { printf(", %2d] %1.*s\n", i, p2 - p1, p1); }
}
close(fd);
}
}
exit(0);
}
Regards
Anders
--
Anders Blomdell Email: [EMAIL PROTECTED]
Department of Automatic Control
Lund University Phone: +46 46 222 4625
P.O. Box 118 Fax: +46 46 138118
SE-221 00 Lund, Sweden
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help