1. A method comprising: recording in a queue of a data container, by a processing device, a first access to a first object of the data container by a first thread of a process; recording in the queue, by the processing device, a second access to a second object of the data container by a second thread of the process; and when the number of accesses recorded in the queue reaches a threshold, locking the data container to prevent threads of the process from accessing objects of the data container and evicting an object of the data container while the data container is locked.