00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include <tut.h>
00014 #include "myrlog.h"
00015 #include "adaptsim.h"
00016
00017 namespace
00018 {
00019
00020 struct test_data
00021 {
00022 test_data()
00023 {
00024 }
00025 };
00026
00027 typedef tut::test_group<test_data> testgroup;
00028 typedef testgroup::object testobject;
00029 testgroup group("memory");
00030
00031 template<>
00032 template<>
00033 void testobject::test<1>()
00034 {
00035 const size_t alloc_size = 1024*1024*64;
00036 size_t before, after, diff;
00037 before = get_mem_footprint();
00038 char* p = new char[alloc_size];
00039 after = get_mem_footprint();
00040 diff = after - before;
00041 rInfo("diff = %lu", static_cast<unsigned long>(diff));
00042 delete p;
00043 ensure(diff > 60*1024*1024);
00044 ensure(diff < 65*1024*1024);
00045 }
00046
00047 template<>
00048 template<>
00049 void testobject::test<2>()
00050 {
00051 const size_t alloc_size = 512*1024;
00052 size_t before, after, diff;
00053 before = get_mem_footprint();
00054 char* p = new char[alloc_size];
00055 after = get_mem_footprint();
00056 diff = after - before;
00057 rInfo("diff = %lu", static_cast<unsigned long>(diff));
00058 delete p;
00059 ensure(diff > 500*1024);
00060 ensure(diff < 520*1024);
00061 }
00062
00063 }