let indice space unique id =
  try Ihmap.find space.indices id
  with Not_found ->
    let base = fst id in
    let a = allocator space base in
    let idx =
      if not a.based && 
        (unique || ( a.index=0 && a.count=1 )) &&
        not (Kset.mem base space.reserved)
      then (a.based <- true ; Base)
      else match a.free with
        | [] ->        
            let k = succ a.index in
            a.index <- k ; Idx k
        | k::ks ->
            a.free <- ks ; Idx k
    in
    Ihmap.add space.indices id idx ; idx