Pebble memory optimization