Index: XIOS/dev/XIOS_DEV_CMIP6/src/buffer_client.cpp
===================================================================
--- XIOS/dev/XIOS_DEV_CMIP6/src/buffer_client.cpp	(revision 1226)
+++ XIOS/dev/XIOS_DEV_CMIP6/src/buffer_client.cpp	(revision 1227)
@@ -37,13 +37,13 @@
   }
 
-  int CClientBuffer::remain(void)
+  StdSize CClientBuffer::remain(void)
   {
     return bufferSize - count;
   }
 
-  bool CClientBuffer::isBufferFree(int size)
+  bool CClientBuffer::isBufferFree(StdSize size)
   {
     if (size > bufferSize)
-      ERROR("bool CClientBuffer::isBufferFree(int size)",
+      ERROR("bool CClientBuffer::isBufferFree(StdSize size)",
             << "The requested size (" << size << " bytes) is too big to fit the buffer (" << bufferSize << " bytes), please increase the client buffer size." << endl);
 
@@ -64,5 +64,5 @@
 
 
-  CBufferOut* CClientBuffer::getBuffer(int size)
+  CBufferOut* CClientBuffer::getBuffer(StdSize size)
   {
     if (size <= remain())
@@ -75,5 +75,5 @@
     else
     {
-      ERROR("CBufferOut* CClientBuffer::getBuffer(int size)",
+      ERROR("CBufferOut* CClientBuffer::getBuffer(StdSize size)",
             << "Not enough space in buffer, this should not have happened...");
       return NULL;
Index: XIOS/dev/XIOS_DEV_CMIP6/src/buffer_client.hpp
===================================================================
--- XIOS/dev/XIOS_DEV_CMIP6/src/buffer_client.hpp	(revision 1226)
+++ XIOS/dev/XIOS_DEV_CMIP6/src/buffer_client.hpp	(revision 1227)
@@ -17,9 +17,9 @@
       ~CClientBuffer();
 
-      bool isBufferFree(int size);
-      CBufferOut* getBuffer(int size);
+      bool isBufferFree(StdSize size);
+      CBufferOut* getBuffer(StdSize size);
       bool checkBuffer(void);
       bool hasPendingRequest(void);
-      int remain(void);
+      StdSize remain(void);
 
     private:
@@ -27,10 +27,13 @@
 
       int current;
-      int count;
-      int bufferedEvents;
-      int maxEventSize;
-      const int maxBufferedEvents;
-      const int bufferSize;
-      const int estimatedMaxEventSize;
+
+      StdSize count;
+      StdSize bufferedEvents;
+      StdSize maxEventSize;
+      const StdSize maxBufferedEvents;
+      const StdSize bufferSize;
+      const StdSize estimatedMaxEventSize;
+
+
       const int serverRank;
       bool pending;
Index: XIOS/dev/XIOS_DEV_CMIP6/src/cxios.cpp
===================================================================
--- XIOS/dev/XIOS_DEV_CMIP6/src/cxios.cpp	(revision 1226)
+++ XIOS/dev/XIOS_DEV_CMIP6/src/cxios.cpp	(revision 1227)
@@ -31,4 +31,5 @@
   const double CXios::defaultBufferSizeFactor = 1.0;
   StdSize CXios::minBufferSize = 1024 * sizeof(double);
+  StdSize CXios::maxBufferSize = std::numeric_limits<int>::max() ;
   bool CXios::printLogs2Files;
   bool CXios::isOptPerformance = true;
@@ -70,4 +71,5 @@
     bufferSizeFactor = getin<double>("buffer_size_factor", defaultBufferSizeFactor);
     minBufferSize = getin<int>("min_buffer_size", 1024 * sizeof(double));
+    maxBufferSize = getin<int>("max_buffer_size", std::numeric_limits<int>::max());
     recvFieldTimeout = getin<double>("recv_field_timeout", 10.0);
     if (recvFieldTimeout < 0.0)
Index: XIOS/dev/XIOS_DEV_CMIP6/src/cxios.hpp
===================================================================
--- XIOS/dev/XIOS_DEV_CMIP6/src/cxios.hpp	(revision 1226)
+++ XIOS/dev/XIOS_DEV_CMIP6/src/cxios.hpp	(revision 1227)
@@ -47,4 +47,5 @@
      static const double defaultBufferSizeFactor; //!< Default factor value
      static StdSize minBufferSize; //!< Minimum buffer size
+     static StdSize maxBufferSize; //!< Maximum buffer size
      static bool isOptPerformance; //!< Check if buffer size is for performance (as large as possible)
      static CRegistry* globalRegistry ; //!< global registry which is wrote by the root process of the servers
Index: XIOS/dev/XIOS_DEV_CMIP6/src/node/context.cpp
===================================================================
--- XIOS/dev/XIOS_DEV_CMIP6/src/node/context.cpp	(revision 1226)
+++ XIOS/dev/XIOS_DEV_CMIP6/src/node/context.cpp	(revision 1227)
@@ -313,5 +313,5 @@
        if (it->second > bufferSize[it->first]) bufferSize[it->first] = it->second;
 
-     // Apply the buffer size factor and check that we are above the minimum buffer size
+     // Apply the buffer size factor, check that we are above the minimum buffer size and below the maximum size
      ite = bufferSize.end();
      for (it = bufferSize.begin(); it != ite; ++it)
@@ -319,4 +319,5 @@
        it->second *= CXios::bufferSizeFactor;
        if (it->second < minBufferSize) it->second = minBufferSize;
+       if (it->second > CXios::maxBufferSize) it->second = CXios::maxBufferSize;
      }
 
