Skip to content

Instantly share code, notes, and snippets.

import cv2 as cv
import os, psutil
process = psutil.Process()
img = cv.UMat(64,64, cv.CV_8U)
out = cv.UMat()
for i in range(100000):
out = cv.resize(img, (64,64))
#out = img
if i % 10000 == 0:
@edman007
edman007 / opencv-leak.cpp
Last active April 15, 2023 20:30
opencv-leak short
#include <opencv2/core/mat.hpp>
int main(int argc, char** argv) {
cv::UMat input;
for (int i = 0; i < 10000; i++){
input.zeros(64, 64, CV_8U);
input.release();
}
return 0;
}
@edman007
edman007 / opencv-leak.cpp
Created April 15, 2023 14:17
OpenCV Leak
/*
* This causes a massive leak on debian bullseye with a Vega3 GPU (no working drivers)
*
* It also prints this message due to bad drivers (they simply don't exist for this GPU, so I'm relying on SW fallbacks)
*
OpenCL program build log: imgproc/resize
Status -11: CL_BUILD_PROGRAM_FAILURE
-D INTER_NEAREST -D T=uchar3 -D T1=uchar -D cn=3 -D AMD_DEVICE
fatal error: cannot open file '/usr/lib/clc/gfx909-amdgcn-mesa-mesa3d.bc': No such file or directory
*
@edman007
edman007 / opencv_debug.cpp
Created February 7, 2022 01:40
OpenCV Issue #6293 - Reproducer
/*
* Copyright (c) 2010 Nicolas George
* Copyright (c) 2011 Stefano Sabatini
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions: