<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:10pt"><div>(defun get-cols-example ()<br> (let* ((matrix (create-mat 5 7 +8uc1+))<br> (submat (foreign-alloc `(:struct cv-mat)<br> :initial-contents '())))<br> (get-cols matrix submat 0 3)<br> (foreign-free submat)))</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">when
i run the above code with the (get-cols matrix submat 0 3) line
commented or without foreign-free it runs fine but as it is above i get
below error <br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"> Error in `/usr/bin/sbcl': free(): invalid next size (fast): 0x00007fffd4000c60 ***</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">in
inferior lisp followed by many lines of code las below. All the
fuinctions in the defun above are neccessary to reproduce issue:</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"> <br>======= Backtrace: =========<br>/lib/x86_64-linux-gnu/libc.so.6(+0x80996)[0x7ffff7154996]<br>[0x100681f7b8]<br>======= Memory map: ========<br>00400000-00435000 r-xp 00000000 08:03 135423 /usr/bin/sbcl<br>00635000-00636000 r-xp 00035000 08:03 135423 /usr/bin/sbcl<br>00636000-00648000 rwxp 00036000 08:03
135423 /usr/bin/sbcl</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">I
dont have any foreign-free functions in my wrappers and the functions
involved GET-COLS and CREATE-MAT are wrappers for OpenCV's cvGetCols
and cvCreateMat...the wrappers are below for debugging purpose</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">;; CvMat* cvGetCols(const CvArr* arr, CvMat* submat, int start_col, int end_col)
<br>(defcfun ("cvGetCols" get-cols) (:pointer (:struct cv-mat))
<br> "Returns array column span."
<br> (arr cv-arr)
<br> (submat (:pointer (:struct cv-mat)))
<br> (start-col :int)
<br> (end-col :int))</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">;; CvMat* cvCreateMat(int rows, int cols, int type)
<br>(defcfun ("cvCreateMat" create-mat) (:pointer (:struct cv-mat))
<br> (rows :int)
<br> (cols :int)
<br> (type :int))
<br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br></div>any way i can help debug this i will and any guidance on this issue is much appreciated =)</div></body></html>