c++ - Why do creating pointer to instances beyond certain number(30) of a 'Structure' with 'stxxl:Vector' as one of its DataType fails? -


i using stxxl library's stxxl::vector in code :

struct b {     typedef stxxl::vector_generator<float>::result vector;     vector content;  }; 

and creating many instances of above declared structure in loop using following code snippet :

 for(i=0;i<50;i++)  {      b* newvect= new b();      // passing above '*newvect' other function  } 

but snippet not create 'newvect' beyond number(30: in case)

however, tried same thing replacing "stxxl:vector" other in memory datatypes :

struct b {     float a,b,c;     int  f,g,h; }; 

above created structure works fine "100000" new instances as:

for(i=0;i<100000;i++) {     b* newvect= new b();     // passing above '*newvect' other function } 

with every system resource remaining same.

please me this.

can "stxxl:iterators" here or work alternative?

what kind of behavior 'stxxl:vector' have in case?

update

tried removing function call each iteration , putting altogether outside loop no help. example code:

#include <stxxl/vector> #include <iostream> using namespace std;  struct buff {     typedef stxxl::vector_generator<float>::result vector;      vector content;  };  struct par {     buff* b[35]; };  void f(par *p) {     for(int h=0;h<35;h++)     {         std::cout<<endl<<"in func: "<<(*p).b[h];         } }  int main() {     par parent;     for(int h=0;h<35;h++)     {         buff* b=new buff();          parent.b[h]=b;         cout<<endl<<"in main: "<<parent.b[h];     }      cout << endl << endl;     f(&parent);      return 0; } 

each stxxl::vector costs specific amount of internal memory, since paging system blocks in external memory.

with default settings, 8 (cachepages) * 4 (pagesize) * 2 mib (blocksize) = 64 mib of ram per stxxl::vector.

so, running out of ram.


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -