anchor.diff:      #q{
           queue = Queue,
           items = Count,
  +        size = Size,
           close_on_dequeue = Close,
           blocked = Blocked
       } = Q,
       case (Max =:= all) orelse (Max >= Count) of
       false ->
  -        {Items, Queue2, Blocked2} = dequeue_items(Max, Queue, Blocked, []),
  -        Q2 = Q#q{items = Count - Max, blocked = Blocked2, queue = Queue2},
  +        {Items, Size2, Queue2, Blocked2} = dequeue_items(
  +            Max, Size, Queue, Blocked, []),
  +        Q2 = Q#q{
  +            items = Count - Max, size = Size2, blocked = Blocked2, queue = Queue2
  +        },
           {reply, {ok, Items}, Q2};
       true ->
           lists:foreach(fun(F) -> gen_server:reply(F, ok) end, Blocked),
           Q2 = Q#q{items = 0, size = 0, blocked = [], queue = queue:new()},
  +        Items = [Item || {Item, _} <- queue:to_list(Queue)],
           case Close of
           false ->
  -            {reply, {ok, queue:to_list(Queue)}, Q2};
  +            {reply, {ok, Items}, Q2};
           true ->
  -            {stop, normal, {ok, queue:to_list(Queue)}, Q2}
  +            {stop, normal, {ok, Items}, Q2}
           end
       end.
   
   
  -dequeue_items(0, Queue, Blocked, DequeuedAcc) ->
  -    {lists:reverse(DequeuedAcc), Queue, Blocked};
  +dequeue_items(0, Size, Queue, Blocked, DequeuedAcc) ->
  +    {lists:reverse(DequeuedAcc), Size, Queue, Blocked};
   
  -dequeue_items(NumItems, Queue, Blocked, DequeuedAcc) ->
  -    {{value, Item}, Queue2} = queue:out(Queue),
  +dequeue_items(NumItems, Size, Queue, Blocked, DequeuedAcc) ->
  +    {{value, {Item, ItemSize}}, Queue2} = queue:out(Queue),
       case Blocked of
       [] ->
           Blocked2 = Blocked;
       [From | Blocked2] ->
           gen_server:reply(From, ok)
       end,
  -    dequeue_items(NumItems - 1, Queue2, Blocked2, [Item | DequeuedAcc]).
  +    dequeue_items(
  +        NumItems - 1, Size - ItemSize, Queue2, Blocked2, [Item | DequeuedAcc]).
       
   
   handle_cast(close, #q{items = 0} = Q) ->
  
positive.code: 
  handle_info(X, Q) ->
      {stop, X, Q}.
  
  increment_queue_size(#q{max_size = nil, size = Size}, _Item) ->
      Size;
  increment_queue_size(#q{size = Size}, Item) when is_binary(Item) ->
      Size + byte_size(Item);
  increment_queue_size(#q{size = Size}, Item) ->
      Size + byte_size(term_to_binary(Item)).
  
negative.code:         {reply, ok, Q}
      end;
  
  handle_call({queue, Item, _}, _From, #q{work_waiters = [{W, _Max} | Rest]} = Q) ->
      gen_server:reply(W, {ok, [Item]}),
      {reply, ok, Q#q{work_waiters = Rest}};
  
  