home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / octa21fs.zip / octave / stdcpp / test / memory.cc < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-15  |  445 b   |  32 lines

  1. // Memory allocation test.
  2.  
  3. #include <iostream.h>
  4. #include <sys/uflags.h>
  5.  
  6. char *char_alloc (long);
  7.  
  8. int main(void)
  9. {
  10.   _uflags (_UF_SBRK_MODEL, _UF_SBRK_ARBITRARY);
  11.  
  12.   char *s = char_alloc (34l * 1024l * 1024l);
  13.  
  14.   if (s)
  15.     {
  16.       cout << s << endl;
  17.       delete s;
  18.     }
  19.  
  20.   return 0;
  21. }
  22.  
  23. char *char_alloc (long size)
  24. {
  25.   char *s = new char [size];
  26.  
  27.   if (s)  strcpy (s, "new erfolgreich ...");
  28.  
  29.   return s;
  30. }
  31.  
  32.