File: showMemory.cc

package info (click to toggle)
libosl 0.8.0-4.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,328 kB
  • sloc: cpp: 114,345; ruby: 1,290; ansic: 915; makefile: 431; perl: 309; sh: 35
file content (28 lines) | stat: -rw-r--r-- 703 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "osl/oslConfig.h"

#include <iostream>

int main(int /*argc*/, char ** /*argv*/)
{
  osl::OslConfig oslConfig;

  std::cout << "Memory Use Limit: " << oslConfig.memoryUseLimit() << "\n";
  std::cout << "Resident Memory Use: " << oslConfig.residentMemoryUse() << "\n";

  const int MAX = 10000000; // 10M
  std::cout << "new int[" << MAX << "]\n";
  int *large_space = new int[MAX];
  std::cout << "Resident Memory Use: " << oslConfig.residentMemoryUse() << "\n";
  
  std::cout << "Delete it\n";
  delete[] large_space;
  std::cout << "Resident Memory Use: " << oslConfig.residentMemoryUse() << "\n";

  return 0;
}

// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End: