diff --git a/src/unit_test_cms.cpp b/src/unit_test_cms.cpp
index 47349ceede31231c68da185a94b5375add5fcbae..50093df18f6fc231e21cefee5df42f7d0abaebbd 100644
--- a/src/unit_test_cms.cpp
+++ b/src/unit_test_cms.cpp
@@ -12,6 +12,7 @@
 
 using namespace std;
 #include "CountMinSketch.hpp"
+#include "main_utils.h"
 
 
 void test_CMS(int lambda,int kappa,int kappa_prime) {
@@ -78,6 +79,16 @@ int main(int argc, char **argv) {
     cout<<"sizeof(int)="<<sizeof(int)<<endl;
     cout<<"sizeof(long)="<<sizeof(long)<<endl;
 
+    cout<<"checking that your machine has enough RAM to run test"<<endl;
+    unsigned long ram=getNodePhysMemory();
+
+    if (ram<5) {
+        cout<<"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<<endl;
+        cout<<" WARNING: skipping this test, it requires at least 4 gigabytes of RAM to run."<<endl;
+        cout<<"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<<endl;
+        return 0;
+    }
+
     cout<<"testing CMS with lambda="<<lambda<<endl;
     test_CMS(lambda,kappa,kappa_prime); // Finally using C arrays (maps implied storing hash keys : 4 Bytes per k_mer overhead) but each array is of size INT_MAX...