anchor.diff:  %% Also note that low memory usages can be the sign of fragmentation in
   %% memory, in which case exploring which specific allocator is at fault
   %% is recommended (see {@link fragmentation/1})
  --spec memory(used | allocated | unused) -> pos_integer()
  -    ;       (usage) -> number().
  -memory(used) ->
  -    mem(total);
  -memory(allocated) ->
  -    AllocProps = [Prop || {_Alloc,Prop} <- util_alloc()],
  -    lists:sum(lists:map(fun(Props) ->
  -        SbcsProps = proplists:get_value(sbcs, Props),
  -        MbcsProps = proplists:get_value(mbcs, Props),
  -        {carriers_size,Sbcs,_,_} = lists:keyfind(carriers_size,1, SbcsProps),
  -        {carriers_size,Mbcs,_,_} = lists:keyfind(carriers_size,1, MbcsProps),
  -        Sbcs+Mbcs
  -    end, AllocProps));
  -memory(unused) ->
  -    memory(allocated) - memory(used);
  -memory(usage) ->
  -    memory(used) / memory(allocated).
  +-spec memory(used | allocated | unused, current | max) -> pos_integer()
  +    ;       (usage, current | max) -> number()
  +    ;       (allocated_types|allocated_instances, current | max) ->
  +                    [{allocator(),pos_integer()}].
  +memory(used,Keyword) ->
  +    lists:sum(lists:map(fun({_,Prop}) ->
  +                                block_size(Prop,Keyword)
  +                        end,util_alloc()));
  +memory(allocated,Keyword) ->
  +    lists:sum(lists:map(fun({_,Prop}) ->
  +                                carrier_size(Prop,Keyword)
  +                        end,util_alloc()));
  +memory(allocated_types,Keyword) ->
  +    lists:foldl(fun({{Alloc,_N},Props},Acc) ->
  +                        CZ = carrier_size(Props,Keyword),
  +                        orddict:update_counter(Alloc,CZ,Acc)
  +                end,orddict:new(),util_alloc());
  +memory(allocated_instances,Keyword) ->
  +    lists:foldl(fun({{_Alloc,N},Props},Acc) ->
  +                        CZ = carrier_size(Props,Keyword),
  +                        orddict:update_counter(N,CZ,Acc)
  +                end,orddict:new(),util_alloc());
  +memory(unused,Keyword) ->
  +    memory(allocated,Keyword) - memory(used,Keyword);
  +memory(usage,Keyword) ->
  +    memory(used,Keyword) / memory(allocated,Keyword).
   
   %% @doc Compares the block sizes to the carrier sizes, both for
   %% single block (`sbcs') and multiblock (`mbcs') carriers.
  
positive.code:     {_libc,_Vsn,Allocators,_Opts} = erlang:system_info(allocator),
      %% versions is deleted in order to allow the use of the orddict api,
      %% and never really having come across a case where it was useful to know.
      [{{A,N},proplists:delete(versions,Props)} ||
          A <- Allocators,
          {_,N,Props} <- erlang:system_info({allocator,A})].
  
  
negative.code: average_group([]) -> [];
  average_group([{Instance,Type1,N},{Instance,Type2,M} | Rest]) ->
      [{Instance,[{Type1,N},{Type2,M}]} | average_group(Rest)].
  
  %% Get the total carrier size
  carrier_size(Props, Keyword) ->
      Pos = key2pos(Keyword),
      SbcsProps = proplists:get_value(sbcs, Props),
      MbcsProps = proplists:get_value(mbcs, Props),
      Sbcs = element(Pos,lists:keyfind(carriers_size, 1, SbcsProps)),
      Mbcs = element(Pos,lists:keyfind(carriers_size, 1, MbcsProps)),
      Sbcs+Mbcs.
  
  %% Get the total block size
  block_size(Props, Keyword) ->
      Pos = key2pos(Keyword),
      SbcsProps = proplists:get_value(sbcs, Props),
      MbcsProps = proplists:get_value(mbcs, Props),
      Sbcs = element(Pos,lists:keyfind(blocks_size, 1, SbcsProps)),
      Mbcs = element(Pos,lists:keyfind(blocks_size, 1, MbcsProps)),
      Sbcs+Mbcs.
  
  %% Create a new snapshot
  snapshot_int() ->
  