Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Split the xml file, and destroy task, to fix memory leaks.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Wed, 20 Feb 2013 16:49:48 +0000 (17:49 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Wed, 20 Feb 2013 17:23:43 +0000 (18:23 +0100)
teshsuite/msg/CMakeLists.txt
teshsuite/msg/pid.c
teshsuite/msg/pid.tesh
teshsuite/msg/pid_d.xml [moved from teshsuite/msg/pid.xml with 59% similarity]
teshsuite/msg/pid_p.xml [new file with mode: 0644]

index eeb9d84..4de0cde 100644 (file)
@@ -25,7 +25,8 @@ set(xml_files
   ${CMAKE_CURRENT_SOURCE_DIR}/get_sender.xml
   ${CMAKE_CURRENT_SOURCE_DIR}/get_sender_d.xml
   ${CMAKE_CURRENT_SOURCE_DIR}/get_sender_p.xml
-  ${CMAKE_CURRENT_SOURCE_DIR}/pid.xml
+  ${CMAKE_CURRENT_SOURCE_DIR}/pid_d.xml
+  ${CMAKE_CURRENT_SOURCE_DIR}/pid_p.xml
   PARENT_SCOPE
   )
 set(teshsuite_src
index ef21c78..54c8901 100644 (file)
@@ -36,7 +36,8 @@ static int killall(int argc, char *argv[]){
   int i;
   for (i=0; i<3;i++) {
     res = MSG_task_receive(&(task), mailbox);
-    int pid = *((int*)MSG_task_get_data(task));
+    int pid = *(int*)MSG_task_get_data(task);
+    MSG_task_destroy(task);
     XBT_INFO("Killing process \"%d\".", pid);
     MSG_process_kill(MSG_process_from_PID(pid));
     task = NULL;
@@ -55,10 +56,10 @@ int main(int argc, char *argv[])
   MSG_function_register("sendpid", &sendpid);
   MSG_function_register("killall", &killall);
 
-  MSG_process_killall(atoi(argv[2]));
+  MSG_process_killall(atoi(argv[3]));
 
   MSG_create_environment(argv[1]);
-  MSG_launch_application(argv[1]);
+  MSG_launch_application(argv[2]);
   res = MSG_main();
 
   if (res == MSG_OK)
index 04b6943..a189463 100644 (file)
@@ -1,4 +1,4 @@
-$ msg/pid ${srcdir:=.}/msg/pid.xml 0 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ msg/pid ${srcdir:=.}/msg/pid_p.xml ${srcdir:=.}/msg/pid_d.xml 0 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
 > [  0.000000] (1:sendpid@toto) Sending pid of "1".
 > [  0.000000] (2:sendpid@toto) Sending pid of "2".
 > [  0.000000] (3:sendpid@toto) Sending pid of "3".
@@ -12,7 +12,7 @@ $ msg/pid ${srcdir:=.}/msg/pid.xml 0 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
 > [  0.003247] (4:killall@toto) Killing process "3".
 > [  0.003247] (3:sendpid@toto) Process "3" killed.
 
-$ msg/pid ${srcdir:=.}/msg/pid.xml 2 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ msg/pid ${srcdir:=.}/msg/pid_p.xml ${srcdir:=.}/msg/pid_d.xml 2 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
 > [  0.000000] (2:sendpid@toto) Sending pid of "2".
 > [  0.000000] (3:sendpid@toto) Sending pid of "3".
 > [  0.000000] (4:sendpid@toto) Sending pid of "4".
similarity index 59%
rename from teshsuite/msg/pid.xml
rename to teshsuite/msg/pid_d.xml
index 8b7d1d8..7475570 100644 (file)
@@ -1,17 +1,9 @@
 <?xml version='1.0'?>
  <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
  <platform version="3">
-   <!-- Platform -->
- <AS  id="AS0"  routing="Full">
-   <host id="toto" power="1000000"/>
-   <link id="lb" bandwidth="100000000" latency="0.000000"/>
-   <route src="toto" dst="toto"><link_ctn id="lb"/></route>    
-  </AS>  
-   
    <!-- Deployment -->
    <process host="toto" function="sendpid"/>
    <process host="toto" function="sendpid"/>
    <process host="toto" function="sendpid"/>
    <process host="toto" function="killall"/>
-
  </platform>
diff --git a/teshsuite/msg/pid_p.xml b/teshsuite/msg/pid_p.xml
new file mode 100644 (file)
index 0000000..f1d4756
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version='1.0'?>
+ <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
+ <platform version="3">
+   <!-- Platform -->
+ <AS  id="AS0"  routing="Full">
+   <host id="toto" power="1000000"/>
+   <link id="lb" bandwidth="100000000" latency="0.000000"/>
+   <route src="toto" dst="toto"><link_ctn id="lb"/></route>
+  </AS>
+ </platform>