jaeandersson / swig

SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages.
http://www.swig.org
Other
23 stars 19 forks source link

Simple consistency check for pointers #54

Closed jaeandersson closed 9 years ago

jaeandersson commented 9 years ago

Raw pointers to the internal SwigPtr struct are now stored in the MATLAB proxy classes. To make this a bit safer I propose to add one more field containing its own address. This field will be set to zero before freeing memory. This can be used as a consistency check giving less sever error messages when memory is corrupted (error instead of segfault).