Changeset 1948 for trunk/test_more


Ignore:
Timestamp:
May 23, 2011 11:33:43 PM (9 years ago)
Author:
bradbell
Message:

merge -r1920:1947 branches/omp_alloc into trunk

Location:
trunk
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/test_more/makefile.am

    r1914 r1948  
    113113        sub_eq.cpp \
    114114        sub_zero.cpp \
     115        track_new_del.cpp \
    115116        value.cpp \
    116117        vec_ad.cpp \
  • trunk/test_more/makefile.in

    r1916 r1948  
    5959        sparse_hessian.cpp sparse_jacobian.cpp sparse_vec_ad.cpp \
    6060        sqrt.cpp std_math.cpp sub.cpp sub_eq.cpp sub_zero.cpp \
    61         value.cpp vec_ad.cpp vec_ad_par.cpp vec_unary.cpp
     61        track_new_del.cpp value.cpp vec_ad.cpp vec_ad_par.cpp \
     62        vec_unary.cpp
    6263@CppAD_ADOLC_TRUE@am__objects_1 = base_adolc.$(OBJEXT)
    6364am_test_more_OBJECTS = $(am__objects_1) test_more.$(OBJEXT) \
     
    8384        sparse_jacobian.$(OBJEXT) sparse_vec_ad.$(OBJEXT) \
    8485        sqrt.$(OBJEXT) std_math.$(OBJEXT) sub.$(OBJEXT) \
    85         sub_eq.$(OBJEXT) sub_zero.$(OBJEXT) value.$(OBJEXT) \
    86         vec_ad.$(OBJEXT) vec_ad_par.$(OBJEXT) vec_unary.$(OBJEXT)
     86        sub_eq.$(OBJEXT) sub_zero.$(OBJEXT) track_new_del.$(OBJEXT) \
     87        value.$(OBJEXT) vec_ad.$(OBJEXT) vec_ad_par.$(OBJEXT) \
     88        vec_unary.$(OBJEXT)
    8789test_more_OBJECTS = $(am_test_more_OBJECTS)
    8890test_more_LDADD = $(LDADD)
     
    321323        sub_eq.cpp \
    322324        sub_zero.cpp \
     325        track_new_del.cpp \
    323326        value.cpp \
    324327        vec_ad.cpp \
     
    438441@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sub_zero.Po@am__quote@
    439442@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_more.Po@am__quote@
     443@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/track_new_del.Po@am__quote@
    440444@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/value.Po@am__quote@
    441445@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vec_ad.Po@am__quote@
  • trunk/test_more/test_more.cpp

    r1717 r1948  
    11/* $Id$ */
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-10 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-11 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
     
    8080extern bool SubEq(void);
    8181extern bool SubZero(void);
     82extern bool track_new_del(void);
    8283extern bool Value(void);
    8384extern bool VecAD(void);
     
    107108                }
    108109                return ok;
     110        }
     111        // function that checks for memrory leaks after all the tests
     112        bool memory_leak(void)
     113        {       bool leak = false;
     114
     115                // dump the memory pool being held for this thread
     116                using CppAD::omp_alloc;
     117                size_t thread = omp_alloc::get_thread_num();
     118                omp_alloc::free_available(thread);
     119       
     120                leak |= CPPAD_TRACK_COUNT() != 0;
     121                leak |= omp_alloc::available(thread) != 0;
     122                leak |= omp_alloc::inuse(thread) != 0;
     123
     124                return leak;
    109125        }
    110126}
     
    178194        ok &= Run( SubEq,           "SubEq"          );
    179195        ok &= Run( SubZero,         "SubZero"        );
     196        ok &= Run( track_new_del,   "track_new_del"  );
    180197        ok &= Run( Value,           "Value"          );
    181198        ok &= Run( VecAD,           "VecAD"          );
     
    191208        using std::endl;
    192209        assert( ok || (Run_error_count > 0) );
    193         if( CPPAD_TRACK_COUNT() == 0 )
    194         {       Run_ok_count++;
    195                 cout << "Ok:    " << "No memory leak detected" << endl;
    196         }
    197         else
     210        if( memory_leak() )
    198211        {       ok = false;
    199212                Run_error_count++;
    200213                cout << "Error: " << "memory leak detected" << endl;
     214        }
     215        else
     216        {       Run_ok_count++;
     217                cout << "Ok:    " << "No memory leak detected" << endl;
    201218        }
    202219        // convert int(size_t) to avoid warning on _MSC_VER systems
Note: See TracChangeset for help on using the changeset viewer.