Hi, for few decade now I'm wondering why, ArcMap leave lock in the file geodatabase.
It's me or something is wrong there. Even if all windows of ArcMap are closed, sometime, when trying to do some catalog things I have the lock window.
When looking in my files, I have always .lock file there for nothing. Have to delete them to make some cleanup. Why ArcMap doesn't do the job itself? I know some of these locks are from ArcMap crash or need to kill the process but....
You have answered your own question, or part of your own question.
I know some of these locks are from ArcMap crash or need to kill the process but....
Regarding the section part of your question, Compact file and personal geodatabases—ArcMap | Documentation (arcgis.com) should clean up orphaned locks.
Yes but not all, I think. But basically, why ArcMap doesn't make cleanup of not use lock and leave garbage in the database?
If ArcMap hard crashes or the user terminates the process, the application has no way of being able to clean up locks. Orphaned locks are a signal/indicator that something is closing abnormally. Esri could code ArcMap to clean up all orphaned locks when a user connects to a GDB, but doing so automatically and behind the scenes could hide the fact something isn't closing correctly.
If you have a specific situation where Compact isn't cleaning up orphaned locks and those locks are causing issues, you can elaborate either here or another post for people to help troubleshoot some more.
Do not need to see this mark in database. We always know when process stop or we kill them.
A cleanup at start could only make database cleaner. But... have to leave with it.