Buffer allocation based on-chip memory optimization for many-core platforms