'tmp' directory is too big in iOS
Asked Answered
H

2

9

I made an app which is 40 MB (very big for me).

But the real surprise is that I found the tmp directory is 300 MB!

And I haven't saved any files in the document yet!

All the files' names in tmp are like:

stack-logs.80127.MyAppName.index
stack-logs.80163.MyAppName.vwnxgi.link
...

What are these things? They occupied an unbelievably 300 MB size!

Is there a way I can clear them periodically? Or is this because I'm debugging my app on my iPhone?

Hornstein answered 5/3, 2012 at 8:24 Comment(0)
J
21

Edit you target scheme, and close LoggingMalloc Stack. Uncheck it.

Journalistic answered 29/9, 2015 at 9:9 Comment(2)
My app was over 27GB in size and this fixed it, thank youMalonylurea
Mine grows to 76 GB. That's insane. I almost forgot I checked this option to find memory leaks.Monson
B
0

The NSTemporaryDirectory() function returns a path to the temporary directory for the current user (not just the application's), so these 300 MB are probably files from other applications using the temporary storage.

Birkner answered 5/3, 2012 at 8:33 Comment(3)
Thanks, so can I just delete the files in my app's tmp directory?Hornstein
You can, since you have the ownership, but it might cause problems with other apps that share it (cached data, etc.).Birkner
@alexander on iOS the NSTemporaryDirectory is private to the app so this is from your app.Crescantia

© 2022 - 2024 — McMap. All rights reserved.