Index: pobysoPythonSage/src/pobyso.py
===================================================================
--- pobysoPythonSage/src/pobyso.py	(revision 115)
+++ pobysoPythonSage/src/pobyso.py	(revision 116)
@@ -742,6 +742,9 @@
 
 def pobyso_lib_init():
     sollya_lib_init(None)
+
+def pobyso_lib_close():
+    sollya_lib_close(None)
     
 def pobyso_name_free_variable(freeVariableNameSa):
     """ Legacy function. See pobyso_name_free_variable_sa_so. """
@@ -1027,10 +1030,15 @@
     taylorFormSo = sollya_lib_taylorform(functionSo, degreeSo, \
                                          intervalCenterSo, \
                                          rangeSo, errorTypeSo, None)
-    (taylorFormListSo, numElementsSo, isEndEllipticSo) = \
+    # taylorFormListSaSo is a Python list of Sollya objects references that 
+    # are copies of the elements of taylorFormSo.
+    # pobyso_get_list_elements_so_so clears taylorFormSo.
+    (taylorFormListSaSo, numElementsSa, isEndEllipticSa) = \
         pobyso_get_list_elements_so_so(taylorFormSo)
-    polySo = sollya_lib_copy_obj(taylorFormListSo[0])
-    errorRangeSo = taylorFormListSo[2]
+    polySo = sollya_lib_copy_obj(taylorFormListSaSo[0])
+    #errorRangeSo = sollya_lib_copy_obj(taylorFormListSaSo[2])
+    #polySo = taylorFormListSaSo[0]
+    errorRangeSo = taylorFormListSaSo[2]
     # No copy_obj needed here: a new object is created.
     maxErrorSo = sollya_lib_sup(errorRangeSo)
     # If changed, reset the Sollya working precision.
@@ -1039,12 +1047,8 @@
         sollya_lib_clear_obj(initialPrecSo)
     if errorTypeIsNone:
         sollya_lib_clear_obj(errorTypeSo)
-    sollya_lib_clear_obj(taylorFormSo)
-    for element in taylorFormListSo:
+    for element in taylorFormListSaSo:
         sollya_lib_clear_obj(element)
-    # Those are cleared with taylorFormSo.
-    #sollya_lib_clear_obj(numElementsSo)
-    #sollya_lib_clear_obj(isEndEllipticSo)
     return((polySo, intervalCenterSo, maxErrorSo))
 # end pobyso_taylor_expansion_no_change_var_so_so
 
Index: pobysoPythonSage/src/sollya_lib.sage
===================================================================
--- pobysoPythonSage/src/sollya_lib.sage	(revision 115)
+++ pobysoPythonSage/src/sollya_lib.sage	(revision 116)
@@ -59,6 +59,8 @@
         sollya_lib_infnorm = sollya.sollya_lib_infnorm
         sollya_lib_init= sollya.sollya_lib_init
         sollya_lib_is_absolute = sollya.sollya_lib_is_absolute
+        sollya_lib_is_empty_object_list = \
+            sollya.sollya_lib_is_empty_object_list
         sollya_lib_is_off = sollya.sollya_lib_is_off
         sollya_lib_is_on = sollya.sollya_lib_is_on
         sollya_lib_mid = sollya.sollya_lib_mid
@@ -134,6 +136,7 @@
 sollya_lib_get_constant_as_int(byref(a), retc)
 print "Precision : ", a.value
 print "Address of a.value ", addressof(a)
+sollya_lib_close(None)
 print "...Sollya library check done."
 #
 #
Index: pobysoPythonSage/src/testPobyso.sage
===================================================================
--- pobysoPythonSage/src/testPobyso.sage	(revision 0)
+++ pobysoPythonSage/src/testPobyso.sage	(revision 116)
@@ -0,0 +1,106 @@
+"""
+Test module for pobyso.py functions.
+
+AUTHORS:
+- S.T. (2014-02-26): initial version
+
+TODO:
+- everything!
+
+"""
+
+print "\ntestPobyso loading..."
+#
+import inspect
+import resource
+
+
+def memory_usage_resource():
+    rusage_denom = RR("1024")
+    if sys.platform == 'darwin':
+        # ... it seems that in OSX the output is different units ...
+        rusage_denom = rusage_denom * rusage_denom
+    mem = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / rusage_denom
+    return mem
+# End memory_usage_resource()
+
+#
+def test_pobyso_absolute_so_so():
+    for index in xrange(0,1000000):
+        absoluteSo = pobyso_absolute_so_so()
+        sollya_lib_clear_obj(absoluteSo)
+# End test_absolute_so_so
+
+def test_pobyso_autoprint_so_so(iterationsNum=1000):
+    absoluteSo = pobyso_absolute_so_so()
+    for index in xrange(0,iterationsNum):
+        pobyso_autoprint(absoluteSo)
+    sollya_lib_clear_obj(absoluteSo)
+# End test_pobyso_autoprint
+
+def test_pobyso_bounds_to_range_sa_so(iterationsNum=10000):
+    global t
+    print "Running", inspect.stack()[0][3]
+    lowerBoundSa = RR(1)
+    upperBoundSa = RR(2)
+    precSo = pobyso_get_prec_so()
+    pobyso_autoprint(precSo)
+    for index in xrange(0,iterationsNum):
+        rangeSo = pobyso_bounds_to_range_sa_so(lowerBoundSa, upperBoundSa)
+        sollya_lib_clear_obj(rangeSo)
+    precSo = pobyso_get_prec_so()
+    pobyso_autoprint(precSo)
+    sollya_lib_clear_obj(precSo)
+# End test_pobyso_bounds_to_range_sa_so
+
+def test_pobyso_get_prec_so_sa(iterationsNum=10000):
+    print "Running", inspect.stack()[0][3]
+    for index in xrange(0,iterationsNum):
+        precSa = pobyso_get_prec_so_sa()
+# End test_pobyso_get_prec_so_sa  
+
+def test_pobyso_get_prec_of_constant_so_sa(iterationsNum=10000):
+    print "Running", inspect.stack()[0][3]
+    constSo = pobyso_constant_from_int_sa_so(2)
+    for index in xrange(0,iterationsNum):
+        precSa = pobyso_get_prec_of_constant_so_sa(constSo)
+    sollya_lib_clear_obj(constSo)
+# End test_pobyso_get_prec_of_constant_so_sa
+
+def test_pobyso_lib_init(iterationsNum=10000):
+    """
+    Must be called exactly once. Leaks lots of memory otherwise.
+    """
+    print "Running", inspect.stack()[0][3]
+    for index in xrange(0,iterationsNum):
+        pobyso_lib_init()
+        #pobyso_lib_close()
+# End test_pobyso_lib_init
+
+def test_pobyso_parse_string_sa_so(iterationsNum=10000):
+    print "Running", inspect.stack()[0][3]
+    for index in xrange(0,iterationsNum):
+        expressionSo = pobyso_parse_string_sa_so('exp(x)+2*x*sin(x)')
+        sollya_lib_clear_obj(expressionSo)
+# End pobyso_parse_string_sa_so
+
+def test_pobyso_taylor_expansion_no_change_var_so_so(iterationsNum=10000):
+    functionSo  = pobyso_parse_string('exp(x)')
+    degreeSo    = pobyso_constant_from_int_sa_so(20)
+    rangeSo     = pobyso_bounds_to_range_sa_so(RR(1),RR(2))
+    errorTypeSo = pobyso_absolute_so_so()
+    for index in xrange(0,iterationsNum):
+        teSo = pobyso_taylor_expansion_no_change_var_so_so(functionSo,
+                                                           degreeSo,
+                                                           rangeSo,
+                                                           errorTypeSo)
+        sollya_lib_clear_obj(teSo[0])
+        sollya_lib_clear_obj(teSo[1])
+        sollya_lib_clear_obj(teSo[2])
+    sollya_lib_clear_obj(functionSo)
+    sollya_lib_clear_obj(degreeSo)
+    sollya_lib_clear_obj(rangeSo)
+    sollya_lib_clear_obj(errorTypeSo)
+# End test_pobyso_taylor_expansion_no_change_var_so_so
+
+print "\t...testPobyso loaded"
\ No newline at end of file
