add checks for object counts, only clear objects when needed
add checks for object counts, only clear objects when needed

realm/realm-js,realm/realm-js,realm/realm-js,realm/realm-js,realm/realm-js,realm/realm-js,realm/realm-js,realm/realm-js,realm/realm-js