The database only frees or overwrites entries on XrmPutResource(), XrmQPutResource(), or XrmMergeDatabases(). A client that is not storing new values into the database or is not merging the database should be safe using the address passed back at any time until it exits. If a resource was found, both XrmGetResource() and XrmQGetResource() return True; otherwise, they return False.
Most applications and toolkits do not make random probes into a resource database to fetch resources. The X toolkit access pattern for a resource database is quite stylized. A series of from 1 to 20 probes are made with only the last name/class differing in each probe. The XrmGetResource() function is at worst a 2n algorithm, where n is the length of the name/class list. This can be improved upon by the application programmer by prefetching a list of database levels that might match the first part of a name/class list.
To obtain a list of database levels, use XrmQGetSearchList().
To search resource database levels for a given resource, use XrmQGetSearchResource().