Ice segregation toward massive protostars