ios - Swift deleting text files: Are these files actually deleted? -


i use following code delete file documents store:

class func removefile(_ itemname:string, fileextension: string) {     let filemanager = filemanager.default     let nsdocumentdirectory = filemanager.searchpathdirectory.documentdirectory     let nsuserdomainmask = filemanager.searchpathdomainmask.userdomainmask     let paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, true)     guard let dirpath = paths.first else {         return     }     let filepath = "\(dirpath)/\(itemname)"     {         try filemanager.removeitem(atpath: filepath)         print("remove done")     } catch let error nserror {         print(error.debugdescription)     } } 

everything works fine, file removed document directory(i downloaded , checked container),

the problem occurs when checking app settings on device, see app size not shrinking when delete these txt files(they quite big, 4,5 mb each, 11.7 mb in documents in data comes them)

enter image description here

my question is:

does code delete file? or maybe delete reference it, memory cannot released?

or maybe delete reference it, memory cannot released?

this. way (all?) modern storage works. in case of ios you're writing flash, original data there until trim called (iirc). cannot guarantee write file overwrite old data, storage controller can place new data anywhere, , true on flash. why "nand attack" exists.


Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -