Index: molecuilder/src/Makefile.am
===================================================================
--- molecuilder/src/Makefile.am	(revision 8afe31fec4bacce8d5073929b048c213af36390f)
+++ molecuilder/src/Makefile.am	(revision 58808e74198b7e8354b7e744d3c4aa5d982c3a13)
@@ -16,5 +16,5 @@
 VectorUnitTest_CXXFLAGS = $(CPPUNIT_CFLAGS)
 VectorUnitTest_LDFLAGS = $(CPPUNIT_LIBS) -ldl
-TesselationUnitTest_SOURCES = defs.hpp helpers.cpp helpers.hpp leastsquaremin.cpp leastsquaremin.hpp linkedcell.cpp linkedcell.hpp tesselation.cpp tesselation.hpp tesselationhelpers.cpp tesselationhelpers.hpp tesselationunittest.cpp tesselationunittest.hpp vector.cpp vector.hpp verbose.cpp verbose.hpp
+TesselationUnitTest_SOURCES = defs.hpp helpers.cpp helpers.hpp leastsquaremin.cpp leastsquaremin.hpp linkedcell.cpp linkedcell.hpp memoryallocator.hpp memoryusageobserver.cpp memoryusageobserver.hpp tesselation.cpp tesselation.hpp tesselationhelpers.cpp tesselationhelpers.hpp tesselationunittest.cpp tesselationunittest.hpp vector.cpp vector.hpp verbose.cpp verbose.hpp
 TesselationUnitTest_CXXFLAGS = $(CPPUNIT_CFLAGS)
 TesselationUnitTest_LDFLAGS = $(CPPUNIT_LIBS) -ldl
Index: molecuilder/src/atom.cpp
===================================================================
--- molecuilder/src/atom.cpp	(revision 8afe31fec4bacce8d5073929b048c213af36390f)
+++ molecuilder/src/atom.cpp	(revision 58808e74198b7e8354b7e744d3c4aa5d982c3a13)
@@ -63,5 +63,5 @@
 {
   Free<int>(&ComponentNr, "atom::~atom: *ComponentNr");
-  Free<char *>(&Name, "atom::~atom: *Name");
+  Free<char>(&Name, "atom::~atom: *Name");
 };
 
Index: molecuilder/src/builder.cpp
===================================================================
--- molecuilder/src/builder.cpp	(revision 8afe31fec4bacce8d5073929b048c213af36390f)
+++ molecuilder/src/builder.cpp	(revision 58808e74198b7e8354b7e744d3c4aa5d982c3a13)
@@ -2057,4 +2057,13 @@
       return 0;
       break;
+    case 2:  // just for -f option
+      delete(molecules); // also free's all molecules contained
+      delete(periode);
+      cout << Verbose(0) <<  "Maximum of allocated memory: "
+        << MemoryUsageObserver::getInstance()->getMaximumUsedMemory() << endl;
+      cout << Verbose(0) <<  "Remaining non-freed memory: "
+        << MemoryUsageObserver::getInstance()->getUsedMemorySize() << endl;
+      return 2;
+      break;
     default:
       break;
Index: molecuilder/src/memoryallocator.hpp
===================================================================
--- molecuilder/src/memoryallocator.hpp	(revision 8afe31fec4bacce8d5073929b048c213af36390f)
+++ molecuilder/src/memoryallocator.hpp	(revision 58808e74198b7e8354b7e744d3c4aa5d982c3a13)
@@ -110,6 +110,7 @@
  *
  * \param pointer to the allocated memory range to free; may be NULL, this function is a no-op then
+ * \param *msg optional error message
  */
-template <typename X> void Free(X** buffer)
+template <typename X> void Free(X** buffer, const char *msg = NULL)
 {
   if ((buffer == NULL) || (*buffer == NULL))
Index: molecuilder/src/memoryusageobserver.cpp
===================================================================
--- molecuilder/src/memoryusageobserver.cpp	(revision 8afe31fec4bacce8d5073929b048c213af36390f)
+++ molecuilder/src/memoryusageobserver.cpp	(revision 58808e74198b7e8354b7e744d3c4aa5d982c3a13)
@@ -77,11 +77,15 @@
  *
  * \param pointer to the allocated piece of memory
+ * \param *msg optional error message
  */
-void MemoryUsageObserver::removeMemory(void* pointer) {
+void MemoryUsageObserver::removeMemory(void* pointer, const char *msg) {
   map<void*, size_t>::iterator current = memoryUsers.find(pointer);
 
   if (current == memoryUsers.end()) {
     cout << "WARNING: There is non-tracked memory to be freed. Pointer "
-      << pointer << " is not registered by MemoryUsageObserver." << endl;
+      << pointer << " is not registered by MemoryUsageObserver: ";
+    if (msg != NULL)
+      cout << *msg;
+    cout << endl;
     return;
   }
Index: molecuilder/src/memoryusageobserver.hpp
===================================================================
--- molecuilder/src/memoryusageobserver.hpp	(revision 8afe31fec4bacce8d5073929b048c213af36390f)
+++ molecuilder/src/memoryusageobserver.hpp	(revision 58808e74198b7e8354b7e744d3c4aa5d982c3a13)
@@ -28,5 +28,5 @@
   static void purgeInstance();
   void addMemory(void* pointer, size_t size);
-  void removeMemory(void* pointer);
+  void removeMemory(void* pointer, const char *msg = NULL);
   size_t getUsedMemorySize();
   size_t getMaximumUsedMemory();
Index: molecuilder/src/molecules.cpp
===================================================================
--- molecuilder/src/molecules.cpp	(revision 8afe31fec4bacce8d5073929b048c213af36390f)
+++ molecuilder/src/molecules.cpp	(revision 58808e74198b7e8354b7e744d3c4aa5d982c3a13)
@@ -1606,5 +1606,5 @@
     MinimiseConstrainedPotential(out, PermutationMap, startstep, endstep, configuration.GetIsAngstroem());
   else {
-    PermutationMap = (atom **) Malloc(AtomCount*sizeof(atom *), "molecule::LinearInterpolationBetweenConfiguration: **PermutationMap");
+    PermutationMap = Malloc<atom *>(AtomCount, "molecule::LinearInterpolationBetweenConfiguration: **PermutationMap");
     Walker = start;
     while (Walker->next != end) {
Index: molecuilder/src/tesselation.cpp
===================================================================
--- molecuilder/src/tesselation.cpp	(revision 8afe31fec4bacce8d5073929b048c213af36390f)
+++ molecuilder/src/tesselation.cpp	(revision 58808e74198b7e8354b7e744d3c4aa5d982c3a13)
@@ -552,5 +552,4 @@
 TesselPoint::~TesselPoint()
 {
-  Free<char *>(&Name, "~TesselPoint - *Name");
 };
 
Index: molecuilder/src/tesselationunittest.cpp
===================================================================
--- molecuilder/src/tesselationunittest.cpp	(revision 8afe31fec4bacce8d5073929b048c213af36390f)
+++ molecuilder/src/tesselationunittest.cpp	(revision 58808e74198b7e8354b7e744d3c4aa5d982c3a13)
@@ -84,5 +84,5 @@
   delete(TesselStruct);
   for (LinkedNodes::iterator Runner = Corners.begin(); Runner != Corners.end(); Runner++) {
-    delete((*Runner)->Name);
+    delete[]((*Runner)->Name);
     delete((*Runner)->node);
     delete(*Runner);
@@ -178,4 +178,5 @@
     for (set<BoundaryTriangleSet*>::iterator TriangleRunner = triangles->begin(); TriangleRunner != triangles->end(); TriangleRunner++)
       CPPUNIT_ASSERT_EQUAL( true, (*TriangleRunner)->ContainsBoundaryPoint(Walker) );
+    delete(triangles);
   }
 }
Index: molecuilder/tests/testsuite.at
===================================================================
--- molecuilder/tests/testsuite.at	(revision 8afe31fec4bacce8d5073929b048c213af36390f)
+++ molecuilder/tests/testsuite.at	(revision 58808e74198b7e8354b7e744d3c4aa5d982c3a13)
@@ -33,16 +33,16 @@
 AT_DATA([test.conf], [])
 AT_CHECK([../../molecuilder test.conf -e ./ -p test.xyz], 0, [ignore], [ignore])
-AT_CHECK([fgrep "Ion_Type1_1" test.conf], 0, [Ion_Type1_1	10.000000000	10.000000000	10.000000000	0 # Number in molecule 0
+AT_CHECK([fgrep "Ion_Type1_1" test.conf], 0, [Ion_Type1_1	10.000000000	10.000000000	10.000000000	0 # molecule nr 0
 ], [ignore])
-AT_CHECK([cp test.conf main_pcp_linux], 0, [ignore], [ignore])
-AT_DATA([input], [aa 10. 10. 10. 1
+AT_CHECK([mv test.conf main_pcp_linux], 0, [ignore], [ignore])
+AT_DATA([input], [maa 10. 10. 10. 1
 s
 q
 ])
-AT_CHECK([../../molecuilder -e ./ <input], 0, [ignore], [ignore])
+AT_CHECK([../../molecuilder test.conf -e ./ <input], 0, [ignore], [ignore])
 AT_CHECK([diff main_pcp_linux test.conf], 0, [ignore], [ignore])
 # 4. test some more configuration
-AT_CHECK([../../molecuilder test.conf -e ./ -t -s -b -F -E -c -b -a -U -T -u], 0, [ignore], [stderr])
-AT_CHECK([fgrep -c "Not enough or invalid" stderr], 0, [10
+AT_CHECK([../../molecuilder test.conf -e ./ -t -s -b -E -c -b -a -U -T -u], 0, [ignore], [stderr])
+AT_CHECK([fgrep -c "Not enough or invalid" stderr], 0, [9
 ], [ignore])
 AT_CLEANUP
@@ -75,5 +75,5 @@
 # 4. create the config and check it
 AT_CHECK([../../molecuilder test.conf -e ./ -p test.xyz], 0, [ignore], [ignore])
-AT_CHECK([fgrep "Ion_Type1_4" test.conf], 0, [Ion_Type1_4	8.532785963	4.787886018	2.645886050	0 # Number in molecule 6
+AT_CHECK([fgrep "Ion_Type1_4" test.conf], 0, [Ion_Type1_4	8.532785963	4.787886018	2.645886050	0 # molecule nr 6
 ], [ignore])
 AT_CHECK([fgrep "Ion_Type2_4" test.conf], 1, [ignore], [ignore])
