more cleanings + use a mutex instead of a spinlock when locking the whole table

since it's locked when growing the table it might retain the lock for long time
which might result in wasting cpu when other threads try to acquire it
while a grow-table is in progress.