Skip to content

Vision resize() leaks JPEGs to cache dir — never cleaned up #28

@agentordinary

Description

@agentordinary

Every call to complete() with images resizes each image and writes it to the app cache dir with a random UUID filename. The resized files are never deleted.

iOS — ios/HybridCactusImage.swift lines 42–48:

let cacheDir = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask)[0]
let fileName = "\(UUID().uuidString).jpg"
let outputURL = cacheDir.appendingPathComponent("cactus/images", isDirectory: true)
  .appendingPathComponent(fileName)

try FileManager.default.createDirectory(at: outputURL.deletingLastPathComponent(), withIntermediateDirectories: true)
try jpegData.write(to: outputURL)

Android follows the same pattern in HybridCactusImage.kt.

For apps that do heavy vision usage the cache dir grows until the OS reaps it. Either clean up after inference or reuse a single temp path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions