source: trunk/test_more/base_alloc.cpp @ 2354

Last change on this file since 2354 was 2341, checked in by bradbell, 8 years ago
  1. Deprecate memory_leak and replace it by thread_alloc::free_all.
  1. Move the special case of examples and tests that use example/base_alloc.hpp

to after memory check because it causes static memory to be allocated
by thread_alloc.hpp (for the value nan).

  1. Remove tracking of static memory allocation in examples

(no longer necessary).

dir_copy.sh: script that moves changes from one machine to another.

  • Property svn:keywords set to Id
File size: 1.0 KB
Line 
1/* $Id: base_alloc.cpp 2341 2012-04-06 18:42:00Z bradbell $ */
2/* --------------------------------------------------------------------------
3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
4
5CppAD is distributed under multiple licenses. This distribution is under
6the terms of the
7                    Common Public License Version 1.0.
8
9A copy of this license is included in the COPYING file of this distribution.
10Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
11-------------------------------------------------------------------------- */
12# include "../example/base_alloc.hpp"
13# include <cppad/cppad.hpp>
14
15bool base_alloc_test(void)
16{       bool ok = true;
17        using CppAD::thread_alloc;
18        typedef CppAD::AD<base_alloc> my_ad;
19
20        // y = x^2
21        CppAD::vector<my_ad>   a_x, a_y;
22        a_x.resize(1);
23        a_x[0] = my_ad(1.);
24        CppAD::Independent(a_x);
25        a_y.resize(1);
26        a_y[0] = a_x[0];
27
28        // create a new parameter for each iteration of this loop
29        size_t i, N = 50;
30        for(i = 0; i < N; i++)
31                a_y[0] += double(i);
32               
33        CppAD::ADFun<base_alloc> f(a_x, a_y);
34
35        return ok;
36}
Note: See TracBrowser for help on using the repository browser.