ColorKit icon indicating copy to clipboard operation
ColorKit copied to clipboard

ColorKit, when using dominantColors(algorithm: .kMeansClustering) memory error

Open Alexandre-BARBIER opened this issue 3 years ago • 4 comments

I'm using this function on each image of a video feed, and after a few seconds/tens of second, my program stops with this error, EXC_BAD_ACCESS (code=1, address=0xd833deece4d0). I assume it comes from this function and precisely kMeansClustering, because I don't encounter this issue using .iterative algorithm

Alexandre-BARBIER avatar Feb 24 '22 12:02 Alexandre-BARBIER

I haven't been able to reproduce this issue. Are you sure that you're releasing the images after processing them?

Boris-Em avatar Dec 17 '22 10:12 Boris-Em

Decoupled private func kMeansClustering(image: NSImage, colorsCount: Int = 8) throws -> [NSColor] to be used separately within the macOS project without the whole library. When we invoke the method to often, than we get a crash mentioned above Screen Shot 2022-12-18 at 6 02 51 PM

vbovasia avatar Dec 18 '22 16:12 vbovasia

  1. Row with the CIKMeans algorithm (ColorKit)
  2. Row with a custom implementation (Not from ColorKit)
  3. Row with .iterative algorithm (ColorKit)
Screen Shot 2022-12-18 at 6 27 17 PM

Dominant_Color_Image_4

vbovasia avatar Dec 18 '22 16:12 vbovasia