rainyl / opencv_dart

OpenCV bindings for Dart language and Flutter. Support Asynchronous Now!
https://pub.dev/packages/opencv_dart
Apache License 2.0
113 stars 14 forks source link

memory leak in v1.0.10 #136

Closed gotecq-thudang closed 2 months ago

gotecq-thudang commented 3 months ago

Memory leak and crash app when i run function detectMarker in version 1.0.10 But in this version, everything work: opencv_dart: git: url: https://github.com/rainyl/opencv_dart ref: 96a936a

This is code: ` final img = cv.imread(arucoImage6x6_250); expect(img.isEmpty, false);

final dict = cv.ArucoDictionary.predefined(cv.PredefinedDictionaryType.DICT_6X6_250);
final params = cv.ArucoDetectorParameters.empty();
final detector = cv.ArucoDetector.create(dict, params);

final (_, ids, _) = detector.detectMarkers(img);
expect(ids, isNotEmpty);

dict.dispose();
params.dispose();
img.dispose();
detector.dispose();`

Hope you could help.

rainyl commented 3 months ago

Didn't reproduce it, worked as expected.

import 'package:opencv_dart/opencv_dart.dart' as cv;

void main(List<String> args) {
  for (int i = 0; i < 100000; i++) {
    final img = cv.imread("test/images/aruco_6X6_250_6.png");

    final dict = cv.ArucoDictionary.predefined(cv.PredefinedDictionaryType.DICT_6X6_250);
    final params = cv.ArucoDetectorParameters.empty();
    final detector = cv.ArucoDetector.create(dict, params);

    final (_, ids, _) = detector.detectMarkers(img);

    dict.dispose();
    params.dispose();
    img.dispose();
    detector.dispose();
  }
}
dart run --pause-isolates-on-start --observe .\test.dart

Memory consumption:

image

If you are sure it occurs, please provide detailed steps to reproduce.

rainyl commented 2 months ago

No further informations, I am going to close this issue, feel free to reopen it if you have more info.