Blob Blame History Raw
+  e - Added a new function DIS_tcp_close to the the code. This takes care of a problem
+      where TORQUE memory keeps growing because the read and write buffers associated
+      with each tcparray entry would grow to accommodate incoming and outgoing data
+      but would not shrink.
 
Index: src/include/dis.h
===================================================================
--- src/include/dis.h	(revision 5257)
+++ src/include/dis.h	(revision 5258)
@@ -238,13 +238,15 @@
 
 /* the following routines set/control DIS over tcp */
 
-extern void DIS_tcp_reset (int fd, int rw);
-extern void DIS_tcp_setup (int fd);
-extern int  DIS_tcp_wflush (int fd);
-extern void DIS_tcp_settimeout (long timeout);
-extern int  DIS_tcp_istimeout (int fd);
+void DIS_tcp_reset (int fd, int rw);
+void DIS_tcp_setup (int fd);
+int  DIS_tcp_wflush (int fd);
+void DIS_tcp_settimeout (long timeout);
+int  DIS_tcp_istimeout (int fd);
+void DIS_tcp_close (int fd);
 
 
+
 extern int  PConnTimeout(int);
 
 /* NOTE:  increase THE_BUF_SIZE to 131072 for systems > 5k nodes */
Index: src/lib/Libattr/attr_fn_arst.c
===================================================================
--- src/lib/Libattr/attr_fn_arst.c	(revision 5257)
+++ src/lib/Libattr/attr_fn_arst.c	(revision 5258)
@@ -186,13 +186,14 @@
 
   bksize = (ns - 1) * sizeof(char *) + sizeof(struct array_strings);
 
-  if ((stp = (struct array_strings *)malloc(bksize)) == NULL)
+  if (( patr->at_val.at_arst = (struct array_strings *)malloc(bksize)) == NULL)
     {
     /* FAILURE */
 
     return(PBSE_SYSTEM);
     }
 
+  stp = patr->at_val.at_arst;
   memset(stp, 0, bksize);
 
   stp->as_npointers = ns;
@@ -238,7 +239,7 @@
 
   patr->at_flags |= ATR_VFLAG_SET | ATR_VFLAG_MODIFY;
 
-  patr->at_val.at_arst = stp;
+/*  patr->at_val.at_arst = stp;*/
 
   free(tmpval);
  
Index: src/lib/Libifl/tcp_dis.c
===================================================================
--- src/lib/Libifl/tcp_dis.c	(revision 5257)
+++ src/lib/Libifl/tcp_dis.c	(revision 5258)
@@ -790,9 +790,30 @@
   return;
   }
 
+void DIS_tcp_close(
 
+  int fd)
 
+  {
+  struct tcp_chan *tcp;
 
+  tcp = tcparray[fd];
+  if(tcp != NULL)
+    {
+    if(tcp->readbuf.tdis_thebuf != NULL)
+      free(tcp->readbuf.tdis_thebuf);
+    if(tcp->writebuf.tdis_thebuf != NULL)
+      free(tcp->writebuf.tdis_thebuf);
+
+    free(tcp);
+    tcparray[fd] = NULL;
+    }
+
+  return;
+  }
+
+
+
 /*
  * DIS_tcp_setup - setup supports routines for dis, "data is strings", to
  * use tcp stream I/O.  Also initializes an array of pointers to
Index: src/lib/Libnet/net_server.c
===================================================================
--- src/lib/Libnet/net_server.c	(revision 5257)
+++ src/lib/Libnet/net_server.c	(revision 5258)
@@ -114,6 +114,7 @@
 #include "server_limits.h"
 #include "net_connect.h"
 #include "log.h"
+#include "dis.h" /* DIS_tcp_close */
 
 extern int LOGLEVEL;
 
@@ -718,6 +719,7 @@
   int sd) /* I */
 
   {
+
   if ((sd < 0) || (max_connection <= sd))
     {
     return;
@@ -757,6 +759,9 @@
 
   num_connections--;
 
+  DIS_tcp_close(sd);
+
+
   return;
   }  /* END close_conn() */