Index: include/tsp_const_def.h
===================================================================
--- include/tsp_const_def.h	(révision 138)
+++ include/tsp_const_def.h	(copie de travail)
@@ -88,10 +88,12 @@
 
 /** used to calculate the socket buffer size */
 #define TSP_DATA_STREAM_MAX_HEADER_SIZE 1024
+/** No more than 2MB buffer size which is already HUGE */
+#define TSP_DATA_STREAM_MAX_BUFFER_MAXSIZE (1024*1024*2)
 /* till now, all elements are doubles, but there will be strings, raw, etc ... */
-#define TSP_DATA_STREAM_MAX_ITEM_SIZE sizeof(double)*8096
+#define TSP_DATA_STREAM_MAX_ITEM_SIZE sizeof(double)*10
 #define TSP_DATA_STREAM_MAX_BUFFER_SIZE(max_nb_items) \
-             ( (max_nb_items) * TSP_DATA_STREAM_MAX_ITEM_SIZE \
+  ( ((max_nb_items) * TSP_DATA_STREAM_MAX_ITEM_SIZE) > TSP_DATA_STREAM_MAX_BUFFER_MAXSIZE ? TSP_DATA_STREAM_MAX_BUFFER_MAXSIZE :  (max_nb_items) * TSP_DATA_STREAM_MAX_ITEM_SIZE \
                               + TSP_DATA_STREAM_MAX_HEADER_SIZE)
 
 
Index: ctrl/tsp_stream_sender.c
===================================================================
--- ctrl/tsp_stream_sender.c	(révision 138)
+++ ctrl/tsp_stream_sender.c	(copie de travail)
@@ -212,21 +212,21 @@
 
   int status;
 
-  STRACE_IO(("-->IN"));
-
   RINGBUF_PTR_INIT(TSP_stream_sender_ringbuf_t,
 		   sock->out_ringbuf,
 		   TSP_stream_sender_item_t, 
 		   sock->buffer_size,
 		   RINGBUF_SZ(sock->fifo_size) );
-
+  
+  /* Memory Exhausted */
+  if (NULL==sock->out_ringbuf) {    
+    return FALSE;
+  }
   assert(sock->out_ringbuf);
 
   status = pthread_create(&sock->thread_id, NULL, TSP_streamer_sender_thread_sender,  sock);
   TSP_CHECK_THREAD(status, FALSE);
  
-  STRACE_IO(("-->OUT"));
-
   return TRUE;
   
 }
Index: ctrl/tsp_group_algo.c
===================================================================
--- ctrl/tsp_group_algo.c	(révision 138)
+++ ctrl/tsp_group_algo.c	(copie de travail)
@@ -237,7 +237,7 @@
 
     }
       
-  STRACE_DEBUG(("Max group size = %d", table->max_group_len));
+  STRACE_INFO(("Max group size = %d", table->max_group_len));
   return table;
 }
                                                              
Index: driver/tsp_consumer.c
===================================================================
--- driver/tsp_consumer.c	(révision 138)
+++ driver/tsp_consumer.c	(copie de travail)
@@ -1126,23 +1126,26 @@
       if(otsp->receiver)
 	{
 	  int status;
-
+	  
 	  /* Create receiver fifo */
 	  RINGBUF_PTR_INIT(TSP_sample_ringbuf_t,
 			   otsp->sample_fifo,
 			   TSP_sample_t,
 			   0,
 			   RINGBUF_SZ(TSP_CONSUMER_RINGBUF_SIZE) )
-	  	    
-	    
-	  /* Begin to receive */
-	  status = pthread_create(&(otsp->thread_receiver), 
-				  NULL,
-				  TSP_request_provider_thread_receiver,
-				  otsp);
 	  
-	  TSP_CHECK_THREAD(status, TSP_STATUS_ERROR_THREAD_CREATE);
-	  retcode = TSP_STATUS_OK;
+	  if (NULL==otsp->sample_fifo) {
+	    retcode = TSP_STATUS_ERROR_MEMORY_ALLOCATION;
+	  } else {	    	    	    
+	    /* Begin to receive */
+	    status = pthread_create(&(otsp->thread_receiver), 
+				    NULL,
+				    TSP_request_provider_thread_receiver,
+				    otsp);
+	    
+	    TSP_CHECK_THREAD(status, TSP_STATUS_ERROR_THREAD_CREATE);
+	    retcode = TSP_STATUS_OK;
+	  }
 	  
 	}
       else
Index: misc_utils/tsp_ringbuf.h
===================================================================
--- misc_utils/tsp_ringbuf.h	(révision 138)
+++ misc_utils/tsp_ringbuf.h	(copie de travail)
@@ -231,17 +231,19 @@
 
 
 
-#define RINGBUF_PTR_INIT(TypeName, name, ItemType, nbSpareBytes, sz) \
-	{ \
-          int mul_offset =  RINGBUF_MULTSUP((sizeof(ItemType) + nbSpareBytes),sizeof(ItemType)) / sizeof(ItemType);\
-	  name = (TypeName*)malloc(sizeof(TypeName) + (sizeof(ItemType) * mul_offset  * sz)); \
-	  (name)->size   = sz; \
-	  (name)->put   = 0; \
-	  (name)->get   = 0; \
-	  (name)->missed = 0; \
-          (name)->mul_offset = mul_offset; \
-          (name)->buf = (ItemType*)((name)+1); \
-	}
+#define RINGBUF_PTR_INIT(TypeName, name, ItemType, nbSpareBytes, sz)	\
+  {									\
+    int mul_offset =  RINGBUF_MULTSUP((sizeof(ItemType) + nbSpareBytes),sizeof(ItemType)) / sizeof(ItemType); \
+    name = (TypeName*)malloc(sizeof(TypeName) + (sizeof(ItemType) * mul_offset  * sz)); \
+    if(NULL!=name) {							\
+      (name)->size   = sz;						\
+      (name)->put   = 0;						\
+      (name)->get   = 0;						\
+      (name)->missed = 0;						\
+      (name)->mul_offset = mul_offset;					\
+      (name)->buf = (ItemType*)((name)+1);				\
+    }									\
+  }
 
 #define RINGBUF_PTR_DESTROY(name)  \
 	{ \
