Open main menu

CDOT Wiki β

Changes

GPU621/Intel Inspector

602 bytes added, 15:00, 11 August 2021
no edit summary
=Invalid Memory Access=
Here we are accessing c[1] which is already deleted upon analyzing this code we get invalid memory access error along with the line number where the invalid access occurs. There are screenshots of this analysis after this code.
<syntaxhighlight lang="cpp" line='line'>
#include<iostream>
int main()
{
char* c;
c = new char[100];//requests heap memory which will not be freed
for (int i = 0;i < 100;i++) {
c[i] = 'a';
}
std::cout << c[10] << std::endl;
 
delete[] c;
c[1] = 'a';
}
</syntaxhighlight>
 
 
[[File:Intel inspector2 - Microsoft Visual Studio 8 11 2021 3 57 42 PM.png|1000px|alt text]]
= Memory Leak =
20
edits