Why is the Runtime creating temporary geodatabase files?

675
6
04-17-2020 04:01 PM
ChrisSeabrooke1
New Contributor III

Using Runtime v100.7.0.0 to run applications that update data in hosted feature services. I've noted that there GEODATABASE files being created in the local Temp folder: Users\[user]\AppData\Local\Temp. The files are named _*.geodatabase, for example:

_0c62-14a8-2e6d-8445.geodatabase.

Why are these files created? Is there some process/method that will clean them up when the code is done? 

0 Kudos
6 Replies
MichaelBranscomb
Esri Frequent Contributor

Hi,

The .geodatabase files improve performance by locally caching (per-session) features downloaded from feature services. On Windows they're in `%temp%` and will therefore be cleaned up when the current temp folder is deleted e.g. when the machine is rebooted.

Alternatively you can specify this location via the API and then clean-up when you choose: ArcGISRuntimeEnvironment.TempPath Property  

Regards

Mike

0 Kudos
dotMorten_esri
Esri Frequent Contributor

The files should get auto-deleted once the garbage collector gets rid of the ServiceFeatureTable (if you hit the stop button during a debugging session, that might not get a chance to happen, so you'll probably see more of these left around when debugging, but shouldn't happen during normal production runs)

0 Kudos
ChrisSeabrooke1
New Contributor III

Mike,

Thank you for the answer. The code is running on a Server, so it's not rebooted very often. I'll investigate specifying the location so we can clean up the files on a scheduled basis. 

0 Kudos
ChrisSeabrooke1
New Contributor III

Morten,

We have tasks running on a Server and the files are not getting deleted. I'm seeing files from 2 or 3 days ago when I run the code on my local machine -- and I shut it down every day-- which according to Michael should  clean up the files. So besides debugging, what would prevent the files from being deleted?

0 Kudos
dotMorten_esri
Esri Frequent Contributor

Well Michael isn't correct :) Windows will decide to clean out the temp folder when it reaches a certain size - a restart won't affect it. 

Having said that I'm not sure why it happens - The Runtime hasn't really been certified to run as a multi-user service in a server, typically if files are left around it would be because a process crashed (similar to stopping a debugging session), and I don't know how you're running this in a server environment but that could be part of the issue.

0 Kudos
JoeHershman
MVP Regular Contributor

If you're running on a server or as a service, don't tell anyone at esri 

0 Kudos