| 101 | } |
| 102 | |
| 103 | inline void |
| 104 | _dealloc_raw(void *ptr, size_t n) |
| 105 | { |
| 106 | # ifdef JALIB_USE_MALLOC |
| 107 | free(ptr); |
| 108 | # else // ifdef JALIB_USE_MALLOC |
| 109 | if (ptr == 0 || n == 0) { |
| 110 | return; |
| 111 | } |
| 112 | |
| 113 | # ifdef JALLOC_DEBUG_STATS |
| 114 | for (int i = 0; i < numAllocArenas; i++) { |
| 115 | if (allocArenas[i].startAddr == ptr) { |
| 116 | allocArenas[i].startAddr = NULL; |
| 117 | allocArenas[i].endAddr = NULL; |
| 118 | break; |
| 119 | } |
| 120 | } |
| 121 | # endif // #ifdef JALLOC_DEBUG_STATS |
| 122 | |
| 123 | int rv = munmap(ptr, n); |
| 124 | if (rv != 0) { |
| 125 | perror("DMTCP(" __FILE__ "): _dealloc_raw: "); |
| 126 | } |
| 127 | |
| 128 | # endif // ifdef JALIB_USE_MALLOC |
| 129 | } |
| 130 | |
| 131 | /* Atomically compares the word at the given 'oldValue' address with the |
| 132 | * word at the given 'dst' address. If the two words are equal, the word |
no test coverage detected