source: trunk/bug/reachable.sh @ 2898

Last change on this file since 2898 was 2898, checked in by bradbell, 7 years ago

Bring up to date so run with current version.

alloc_global.sh: fix check so does not fail when cannot get enough threads.

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 1.6 KB
Line 
1#! /bin/bash -e
2# $Id: reachable.sh 2898 2013-09-18 13:07:32Z bradbell $
3# -----------------------------------------------------------------------------
4# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-13 Bradley M. Bell
5#
6# CppAD is distributed under multiple licenses. This distribution is under
7# the terms of the
8#                     Eclipse Public License Version 1.0.
9#
10# A copy of this license is included in the COPYING file of this distribution.
11# Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
12# -----------------------------------------------------------------------------
13#
14if [ ! -e build ]
15then
16        mkdir build
17fi
18cd build
19if [ ! -e ../../cppad/configure.hpp ]
20then
21        cmake ../..
22fi
23#
24echo "create reachable.cpp"
25cat << EOF > reachable.cpp
26# include <iostream>
27# include <vector>
28# include <cppad/cppad.hpp>
29
30# define SHOW_ERROR 1
31
32int main (int argc, char *argv[])
33{
34  CppAD::vector< CppAD::AD<double> > x(2);
35  x.resize(0);
36
37  // vagrind will generate an error message about a reachable block of memory.
38  // The intention is that, when no multi-threading is done, the user should
39  // note have to worry about the CppAD::thread_alloc memory allocator; i.e.,
40  // this should not be necessary.
41# if ! SHOW_ERROR
42  CppAD::thread_alloc::free_available(0);
43# endif
44
45  return 0;
46}
47EOF
48#
49echo "g++ -g -I../..  -std=c++11 reachable.cpp -o reachable"
50g++ -g -I../.. -std=c++11 reachable.cpp -o reachable
51#
52echo "valgrind --leak-check=full --show-reachable=yes ./reachable"
53valgrind --leak-check=full --show-reachable=yes ./reachable
54#
55echo "rm reachable reachable.cpp"
56rm reachable reachable.cpp
Note: See TracBrowser for help on using the repository browser.