added bmalloc calls in shm-mem functions, although keeping the existing code commented