| 139 | } |
| 140 | |
| 141 | int |
| 142 | mtrash_ctor(void *mem, int size, void *arg, int flags) |
| 143 | { |
| 144 | struct malloc_type **ksp; |
| 145 | uint32_t *p = mem; |
| 146 | int cnt; |
| 147 | |
| 148 | #ifdef DEBUG_MEMGUARD |
| 149 | if (is_memguard_addr(mem)) |
| 150 | return (0); |
| 151 | #endif |
| 152 | |
| 153 | size -= sizeof(struct malloc_type *); |
| 154 | ksp = (struct malloc_type **)mem; |
| 155 | ksp += size / sizeof(struct malloc_type *); |
| 156 | cnt = size / sizeof(uma_junk); |
| 157 | |
| 158 | for (p = mem; cnt > 0; cnt--, p++) |
| 159 | if (*p != uma_junk) { |
| 160 | printf("Memory modified after free %p(%d) val=%x @ %p\n", |
| 161 | mem, size, *p, p); |
| 162 | panic("Most recently used by %s\n", (*ksp == NULL)? |
| 163 | "none" : (*ksp)->ks_shortdesc); |
| 164 | } |
| 165 | return (0); |
| 166 | } |
| 167 | |
| 168 | /* |
| 169 | * Fills an item with predictable garbage |
no test coverage detected