New pricing changes went into effect on July 16, 2018. For more information, check out the Guide for Existing Users.


The Places SDK for Android includes a number of buffers, which require special handling to prevent your app suffering from memory leaks:

Note the following points when working with buffers:

  • To prevent a memory leak, you must release the buffer object when your app no longer needs it, by calling the buffer's release() method.
  • If you want to continue using the object contained in the buffer after you've released the buffer, call freeze() on the object before calling buffer.release(). Note that calling freeze() on an object may result in increased memory usage, because it may create an additional copy of the object. (It doesn't create an additional copy on an already-frozen object.) You should therefore freeze an object only if you need to access it after releasing the buffer.

The following example illustrates buffer handling for a PlaceBuffer

PlaceBuffer buffer = GeoDataApi.getPlaceById(id1, id2, ...);

Place place = buffer.get(0);

// It's OK to use the place object here, as the buffer hasn't been released yet.
String name = place.getName();

Place frozen = place.freeze();


// If you call place.getName() here, an exception is thrown,
// because the buffer has been released.
// Instead, use the frozen Place object.
name = frozen.getName();

You can use isDataValid() at any time to determine if the object is available or not. For example, place.isDataValid() returns true before the call to buffer.release() and false afterwards. Note that frozen.isDataValid() returns true both before and after the buffer has been released.


Places SDK for Android