allocate all structure before build connection