SHARE
TWEET

sizetest.cpp

a guest Oct 13th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   1 #include <unistd.h>
  2.   2 #include "random_points.h"
  3.   3
  4.   4 struct Tri { Point a; Point b; Point c; };
  5.   5
  6.   6 int main(int argc, char **argv)
  7.   7 {
  8.   8     // See if this segfaults...
  9.   9     //Tri test[161700];
  10.  10     unsigned int target = 161700;
  11.  11     unsigned int incr   =   1000;
  12.  12     std::cout << "Triangles are of size " << sizeof(Tri) << std::endl;
  13.  13     for(int ma = 0; ma < target; ma += incr)
  14.  14     {
  15.  15         Tri test[ma+1];
  16.  16         std::cout << "\rAllocated " << ma+1 << " triangles, totalling size " << sizeof(test) << " ";
  17.  17         std::cout.flush();
  18.  18         usleep(10000);
  19.  19     }
  20.  20     return 0;
  21.  21 }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top