pastebin - collaborative debugging tool
rovema.kpaste.net RSS


__gnu_cxx::bitmap_allocator demo #002
Posted by Anonymous on Wed 22nd Jun 2022 09:08
raw | new post

  1. #include <iostream>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <stdio.h>
  5.  
  6.  
  7. #if 1
  8. #include <ext/bitmap_allocator.h>
  9. __gnu_cxx::bitmap_allocator<char> testAllocator;
  10. #else
  11. #include <ext/mt_allocator.h>
  12. __gnu_cxx::__mt_alloc<char> testAllocator;
  13. #endif
  14.  
  15.  
  16. using namespace std;
  17.  
  18. int main(int argc, char *argv[])
  19. {
  20.         (void)puts("# start.");
  21.         char *s = testAllocator.allocate(512);
  22.  
  23.         (void)strcpy(s, "frog attack");
  24.        
  25.         (void)printf("|%s|\n", s);
  26.  
  27.         testAllocator.deallocate(s, 512);
  28.         (void)puts("# end.");
  29.         return 0;
  30. }

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at