Index: /cpp/frams/_demos/simil_test.cpp
===================================================================
--- /cpp/frams/_demos/simil_test.cpp	(revision 454)
+++ /cpp/frams/_demos/simil_test.cpp	(revision 455)
@@ -71,6 +71,6 @@
 
     // prepare output parameters from .gen file
-    vector<Geno *> *pvGenos = new vector<Geno *>();
-    vector<char *> *pvNames = new vector<char *>();
+    vector<Geno *> pvGenos = vector<Geno *>();
+    vector<char *> pvNames = vector<char *>();
 
     // check if there is a switch
@@ -138,8 +138,8 @@
         if ((pNextGenotype != NULL) && (pNextGenotype->isValid()))
         {
-            pvGenos->push_back(pNextGenotype);
+            pvGenos.push_back(pNextGenotype);
             char *szNewName = new char [ loaded->name.len() + 1];
             strcpy(szNewName, loaded->name.c_str());
-            pvNames->push_back(szNewName);
+            pvNames.push_back(szNewName);
         }
         else
@@ -157,18 +157,18 @@
 
     // create the empty array of similarities
-    aaSimil = new pDouble [pvGenos->size()];
-    for (unsigned int k = 0; k < pvGenos->size(); k++)
-    {
-        aaSimil[k] = new double [pvGenos->size()];
-		for (unsigned int l = 0; l < pvGenos->size(); l++)
+    aaSimil = new pDouble [pvGenos.size()];
+    for (unsigned int k = 0; k < pvGenos.size(); k++)
+    {
+        aaSimil[k] = new double [pvGenos.size()];
+		for (unsigned int l = 0; l < pvGenos.size(); l++)
             aaSimil[k][l] = 0.0;
     }
 
     // compute and remember similarities
-	for (unsigned int i = 0; i < pvGenos->size(); i++)
-    {
-		for (unsigned int j = 0; j < pvGenos->size(); j++)
-        {
-            dSimilarity = M.EvaluateDistance(pvGenos->operator[](i), pvGenos->operator[](j));
+	for (unsigned int i = 0; i < pvGenos.size(); i++)
+    {
+		for (unsigned int j = 0; j < pvGenos.size(); j++)
+        {
+            dSimilarity = M.EvaluateDistance(pvGenos.operator[](i), pvGenos.operator[](j));
             aaSimil[i][j] = dSimilarity;
         }
@@ -179,15 +179,15 @@
         // if "-names" switch was given,
         // print the number of genotypes and their names
-        printf("%li\n", pvGenos->size());
-		for (unsigned int iGen = 0; iGen < pvNames->size(); iGen++)
-        {
-            printf("%s\n", pvNames->at(iGen));
+        printf("%li\n", pvGenos.size());
+		for (unsigned int iGen = 0; iGen < pvNames.size(); iGen++)
+        {
+            printf("%s\n", pvNames.at(iGen));
         }
     }
 
     // print out the matrix of similarities
-	for (unsigned int i = 0; i < pvGenos->size(); i++)
-    {
-		for (unsigned int j = 0; j < pvGenos->size(); j++)
+	for (unsigned int i = 0; i < pvGenos.size(); i++)
+    {
+		for (unsigned int j = 0; j < pvGenos.size(); j++)
         {
             printf("%.2lf\t", aaSimil[i][j]);
@@ -197,13 +197,11 @@
 
     // delete vectors and arrays
-	for (unsigned int i = 0; i < pvGenos->size(); i++)
-    {
-        delete pvGenos->operator[](i);
-        delete [] pvNames->operator[](i);
+	for (unsigned int i = 0; i < pvGenos.size(); i++)
+    {
+        delete pvGenos.operator[](i);
+        delete [] pvNames.operator[](i);
         delete [] aaSimil[i];
     }
 
-    delete pvGenos;
-    delete pvNames;
     delete [] aaSimil;
 
Index: /cpp/frams/model/similarity/SVD/matrix_tools.cpp
===================================================================
--- /cpp/frams/model/similarity/SVD/matrix_tools.cpp	(revision 454)
+++ /cpp/frams/model/similarity/SVD/matrix_tools.cpp	(revision 455)
@@ -15,5 +15,5 @@
 double *Create(int nSize)
 {
-	double *matrix = (double *)malloc(nSize * sizeof(double));
+	double *matrix = new double[nSize];
 
 	for (int i = 0; i < nSize; i++)
@@ -40,5 +40,5 @@
 
 	if (delSize != 0)
-		free(toDel);
+		delete[] toDel;
 	return c;
 }
@@ -71,5 +71,5 @@
 
 	if (delSize != 0)
-		free(toDel);
+		delete[] toDel;
 
 	return m_Power;
@@ -170,8 +170,8 @@
 		B = Multiply(B, Z, nSize, nSize, nSize, B, nSize);
 
-		free(Ones);
-		free(Eye);
-		free(Z);
-		free(D);
+		delete[] Ones;
+		delete[] Eye;
+		delete[] Z;
+		delete[] D;
 	}
 
@@ -186,6 +186,6 @@
 	double *W = Transpose(Vt, nSize, nSize);
 
-	free(B);
-	free(Vt);
+	delete[] B;
+	delete[] Vt;
 
 	for (int i = 0; i < nSize; i++)
@@ -202,5 +202,5 @@
 	sqS = Power(S, nSize, nSize, 0.5, S, nSize);
 	dCoordinates = Multiply(W, sqS, nSize, nSize, nSize, W, nSize);
-	free(sqS);
+	delete[] sqS;
 
 	for (int i = 0; i < nSize; i++)
@@ -222,5 +222,5 @@
 	}
 
-	free(Eigenvalues);
-	free(dCoordinates);
-}
+	delete[] Eigenvalues;
+	delete[] dCoordinates;
+}
