When I use the commands:
loadlibrary('testdll', 'testdll.h');theclass = calllib('testdll', 'xxx_Construct');len = 4096;b = zeros(4096, 1, 'uint8');pb = libpointer('uint8Ptr', b);for q=1:N [x,ret] = calllib('testdll', 'xxx_DoIt', theclass, len, pb);end
Where "theclass" is a pointer to a C++ class that defines the "xxx_DoIt" function, and "pb" is a libpointer to a MATLAB matrix, I see that after each call to the CALLLIB function, MATLAB consumes more and more memory, even though "xxx_DoIt" function does not allocate any memory.
Best Answer