|
Revision 2828, 4.1 kB
(checked in by patrickh, 8 years ago)
|
Updated the copyright to what ISU's lawyers decided they want now.
The vast majority of this was done using Kevin's auto-copyright.pl script
which definitely made this easier. All the copyright blocks now have
begin and end tags so that if and when we have to update the copyright
information again, it will be even simpler.
|
- Property svn:eol-style set to
native
- Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 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 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
#ifndef _MemPoolSGI_h_ |
|---|
| 35 |
#define _MemPoolSGI_h_ |
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 |
|
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 |
#include <vjConfig.h> |
|---|
| 63 |
#include <stdio.h> |
|---|
| 64 |
#include <unistd.h> |
|---|
| 65 |
#include <ulocks.h> |
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 |
class vjMemPoolSGI : public vjMemPool |
|---|
| 73 |
{ |
|---|
| 74 |
public: |
|---|
| 75 |
vjMemPoolSGI(size_t initialSize = 65536, int numProcs = 8, |
|---|
| 76 |
char* staticTempName = "/var/tmp/memPoolSGIXXXXXX"); |
|---|
| 77 |
|
|---|
| 78 |
virtual ~vjMemPoolSGI() { |
|---|
| 79 |
usdetach(arena); |
|---|
| 80 |
unlink(arenaFileName); |
|---|
| 81 |
std::cerr << "\nUnlinking: " << arenaFileName << std::endl; |
|---|
| 82 |
} |
|---|
| 83 |
|
|---|
| 84 |
public: |
|---|
| 85 |
virtual void* allocate(size_t size) |
|---|
| 86 |
{ |
|---|
| 87 |
void* retval; |
|---|
| 88 |
retval = usmalloc(size, arena); |
|---|
| 89 |
|
|---|
| 90 |
if (retval == NULL) |
|---|
| 91 |
std::cerr << "MemPoolSGI: Out of memory!!!" << std::endl; |
|---|
| 92 |
|
|---|
| 93 |
return retval; |
|---|
| 94 |
} |
|---|
| 95 |
|
|---|
| 96 |
virtual void deallocate(void* ptr) |
|---|
| 97 |
{ |
|---|
| 98 |
usfree(ptr, arena); |
|---|
| 99 |
} |
|---|
| 100 |
|
|---|
| 101 |
virtual void* reallocate(void *ptr, size_t new_sz) |
|---|
| 102 |
{ |
|---|
| 103 |
return usrealloc(ptr, new_sz, arena); |
|---|
| 104 |
} |
|---|
| 105 |
|
|---|
| 106 |
public: |
|---|
| 107 |
usptr_t* getArena() |
|---|
| 108 |
{ return arena;} |
|---|
| 109 |
|
|---|
| 110 |
public: |
|---|
| 111 |
|
|---|
| 112 |
|
|---|
| 113 |
|
|---|
| 114 |
|
|---|
| 115 |
static void init(size_t initialSize = 32768, int numProcs = 64, |
|---|
| 116 |
char* staticTempName = "/var/tmp/memPoolsArenaXXXXXX"); |
|---|
| 117 |
|
|---|
| 118 |
void* operator new(size_t sz) |
|---|
| 119 |
{ |
|---|
| 120 |
std::cerr << "MemPoolSGI::new called. sz:" << sz << "\n"; |
|---|
| 121 |
if (arenaForMemPools == NULL) |
|---|
| 122 |
init(); |
|---|
| 123 |
|
|---|
| 124 |
return usmalloc(sizeof(vjMemPoolSGI), arenaForMemPools); |
|---|
| 125 |
} |
|---|
| 126 |
|
|---|
| 127 |
void operator delete(void* ptr) |
|---|
| 128 |
{ |
|---|
| 129 |
usfree(ptr, arenaForMemPools); |
|---|
| 130 |
} |
|---|
| 131 |
|
|---|
| 132 |
private: |
|---|
| 133 |
usptr_t* arena; |
|---|
| 134 |
char* arenaFileName; |
|---|
| 135 |
|
|---|
| 136 |
private: |
|---|
| 137 |
static usptr_t* arenaForMemPools; |
|---|
| 138 |
static char* arenaForMemPoolsFileName; |
|---|
| 139 |
}; |
|---|
| 140 |
|
|---|
| 141 |
#endif |
|---|