add code for main sharememory work