// Copyright (c) Keith D Gregory, all rights reserved
package com.kdgregory.example.memory;

import java.util.ArrayList;
import java.util.List;


/**
 *  This program consumes random-sized chunks of memory until it runs out.
 *  The sleep() call allows this to take enough time that you can attach
 *  a heap analyzer.
 */
public class Gobbler
{
    public static void main(String[] argv)
    throws Exception
    {
        List<byte[]> holder = new ArrayList<byte[]>();
        while (true)
        {
            int size = (int)(65536 * Math.random());
            holder.add(new byte[size]);
//            Thread.sleep(100L);
        }
    }
}
