Diagnosis of memory leaks?

PC-lint Plus User Discussion
Post Reply
rbriggs

Diagnosis of memory leaks?

Post by rbriggs » Mon Oct 21, 2019 7:13 pm

Hello,

I write to you today in earnest with an inquiry regarding the present topic for "PC-lint Plus". Can detection be elicited with respect to memory which having been allocated then is subject to an unfortunate failure to deallocate? This is in theory made with "new", but, then, where it should be "delete", there is in fact, no "delete", but nothing, and the memory leaks - or "malloc" et cetera. Is this diagnosed?

Thank you sincerely

mmetivier

Re: Diagnosis of memory leaks?

Post by mmetivier » Wed Oct 23, 2019 1:28 pm

There are several messages that purport to diagnose memory leaks, for example:

423: assignment to custodial pointer _symbol_ likely creates memory leak
429: custodial pointer _symbol_ likely not _string_ nor returned
593: custodial pointer _symbol_ possibly not _string_ nor returned
672: assignment to custodial pointer _symbol_ possibly creates memory leak
698: in-place realloc of _symbol_ could cause a memory leak

Working in an embedded environment in which dynamic memory allocation is strictly forbidden, I have not tested these conditions and so can't speak to the thoroughness of Gimpel's analysis, but it does seem to be available.

You could probably check a snippet that you're interested in by using the online demo at https://www.gimpel.com/demo.html

Post Reply