{"id":296148,"date":"2019-12-20T15:00:46","date_gmt":"2019-12-20T15:00:46","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=296148"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=296148","title":{"rendered":"\u041b\u043e\u0432\u0438\u043c \u0443\u0442\u0435\u0447\u043a\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u0432 \u0421\/\u0421++"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/480368\/\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/u4\/5k\/td\/u45ktd0wvbjglbnusjeg-pwyrmq.jpeg\"><\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e \u0432\u0430\u0441, \u0425\u0430\u0431\u0440\u043e\u0432\u0447\u0430\u043d\u0435!<\/p>\n<p>  <\/p>\n<p>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0445\u043e\u0447\u0443 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0441\u0432\u0435\u0442 \u043d\u0430\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u0431\u043e\u0440\u043e\u0442\u044c\u0441\u044f \u0441 \u0443\u0442\u0435\u0447\u043a\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0432 \u0421\u0438 \u0438\u043b\u0438 \u0421++.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430 \u0425\u0430\u0431\u0440\u0435 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u0432\u0435 \u0441\u0442\u0430\u0442\u044c\u0438, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e: <a href=\"https:\/\/habr.com\/ru\/post\/82514\/\">\u0411\u043e\u0440\u0435\u043c\u0441\u044f \u0441 \u0443\u0442\u0435\u0447\u043a\u0430\u043c\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 (C++ CRT)<\/a> \u0438 <a href=\"https:\/\/habr.com\/ru\/post\/113567\/\">\u0423\u0442\u0435\u0447\u043a\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u0432 \u0421++: Visual Leak Detector<\/a>. \u041e\u0434\u043d\u0430\u043a\u043e \u044f \u0441\u0447\u0438\u0442\u0430\u044e, \u0447\u0442\u043e \u043e\u043d\u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0440\u0430\u0441\u043a\u0440\u044b\u0442\u044b, \u0438\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u043c\u043e\u0433\u0443\u0442 \u043d\u0435 \u0434\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u0432\u0430\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043f\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u044b, \u0434\u0430\u0431\u044b \u043e\u0431\u043b\u0435\u0433\u0447\u0438\u0442\u044c \u0432\u0430\u043c \u0436\u0438\u0437\u043d\u044c. <\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p><strong>Windows \u2014 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430<\/strong><br \/>  \u041d\u0430\u0447\u043d\u0435\u043c \u0441 Windows, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043f\u043e\u0434 Visual Studio, \u0442\u0430\u043a \u043a\u0430\u043a \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432 \u043f\u0438\u0448\u0443\u0442 \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u0434 \u044d\u0442\u043e\u0439 IDE. <\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/me\/gj\/vd\/megjvd674_ifi-0fywxd_g3xefy.jpeg\"><\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u043f\u0440\u0438\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Main.c<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">struct Student create_student(); void ControlMenu();  int main() {     ControlMenu();     return 0; }  void ShowListMenu(int kX) {     char listMenu[COUNT_LIST_MENU][55] = { {\"Read students from file\"}, {\"Input student and push\"},     {\"Input student and push it back\"}, {\"Input student and push it after student\"},     {\"Delete last student\"}, {\"Write students to file\"}, {\"Find student\"}, {\"Sort students\"},     {\"Show list of students\"}, {\"Exit\"} };     for (int i = 0; i &lt; COUNT_LIST_MENU; i++)     {         if (i == kX)         {             printf(\"%s\", listMenu[i]);             printf(\" &lt;=\\n\");         }         else             printf(\"%s\\n\", listMenu[i]);     } }  void ControlMenu() {     struct ListOfStudents* list = NULL;     int kX = 0, key;     int exit = FALSE;     ShowListMenu(kX);     do     {         key = _getch();         switch (key)         {         case 72: \/\/up         {             if (kX == 0)                 kX = COUNT_LIST_MENU-1;             else                 kX--;         }break;         case 80: \/\/down         {             if (kX == COUNT_LIST_MENU-1)                 kX = 0;             else                 kX++;         }break;         case 13:         {             if (kX == 0)             {                 int sizeStudents = 0;                 struct Student* students = (struct Student*)malloc(1 * sizeof(struct Student));                 char* path = (char*)malloc(255 * sizeof(char));                 printf(\"Put the path to file with students: \");                 scanf(\"%s\", path);                 int size = 0;                 students = read_students(path, &amp;size);                 if (students == NULL)                 {                     printf(\"Can't open this file.\\n\");                 }                 else                 {                     for (int i = 0; i &lt; size; i++)                     {                         if (i == 0)                         {                             list = init(students[i]);                         }                         else                         {                             list = add_new_elem_to_start(list, students[i]);                         }                     }                 }                                 free(students);                 printf(\"\\nPress any key to continue...\");                 getchar();                 getchar();                 free(path);             }             else if (kX == 1 || kX == 2 || kX == 3 || kX == 6)             {                 struct Student student = create_student();                 if (kX == 1)                 {                     if (list == NULL)                     {                         list = init(student);                     }                     else                     {                         list = add_new_elem_to_start(list, student);                     }                     printf(\"\\nPress any key to continue...\");                     getchar();                     getchar();                 }                 else if (kX == 2)                 {                     if (list == NULL)                     {                         list = init(student);                     }                     else                     {                         list = add_new_elem_to_end(list, student);                     }                     printf(\"\\nPress any key to continue...\");                     getchar();                     getchar();                 }                 else if (kX == 3)                 {                     if (list == NULL)                     {                         list = init(student);                         printf(\"The list was empty, so, list have been created.\\n\");                     }                     else                     {                         int position;                         printf(\"Put the position: \");                         scanf(\"%d\", &amp;position);                         list = add_new_elem_after_pos(list, student, position);                     }                     printf(\"\\nPress any key to continue...\");                     getchar();                     getchar();                 }                 else                 {                     if (find_elem(list, student))                         printf(\"Student exist\");                     else                         printf(\"Student doesn't exist\");                     printf(\"\\nPress any key to continue...\");                     getchar();                     getchar();                 }             }             else if (kX == 4)             {                 if (list == NULL)                 {                     printf(\"List is empty.\\n\");                 }                 else                 {                     list = delete_elem(list);                 }                 printf(\"\\nPress any key to continue...\");                 getchar();                 getchar();             }             else if (kX == 5)             {                 char* path = (char*)malloc(255 * sizeof(char));                 printf(\"Put the path to file with students: \");                 scanf(\"%s\", path);                 if (write_students(list, path) == 0)                 {                     printf(\"Can't write\");                     printf(\"\\nPress any key to continue...\");                     getchar();                     getchar();                 }                 free(path);             }             else if (kX == 7)             {                 if (list == NULL)                 {                     printf(\"List is empty.\\n\");                 }                 else                 {                     list = sort_list(list);                 }                 printf(\"\\nThe list was successfully sorted\");                 printf(\"\\nPress any key to continue...\");                 getchar();                 getchar();             }             else if (kX == 8)             {                 system(\"cls\");                 show_list(list);                 printf(\"\\nPress any key to continue...\");                 getchar();                 getchar();             }             else                 exit = TRUE;         }break;         case 27:         {             exit = TRUE;         }break;         }         system(\"cls\");         ShowListMenu(kX);     } while (exit == FALSE);     while (list != NULL)     {         list = delete_elem(list);     } }  struct Student create_student() {     struct Student new_student;     do     {         printf(\"Write the name of student\\n\");         scanf(\"%s\", new_student.first_name);     } while (strlen(new_student.first_name) == 0);     do     {         printf(\"Write the last name of student\\n\");         scanf(\"%s\", new_student.last_name);     } while (strlen(new_student.last_name) == 0);     do     {         printf(\"Write the patronyminc of student\\n\");         scanf(\"%s\", new_student.patronyminc);     } while (strlen(new_student.patronyminc) == 0);     do     {         printf(\"Write the city of student\\n\");         scanf(\"%s\", new_student.city);     } while (strlen(new_student.city) == 0);     do     {         printf(\"Write the district of student\\n\");         scanf(\"%s\", new_student.disctrict);     } while (strlen(new_student.disctrict) == 0);     do     {         printf(\"Write the country of student\\n\");         scanf(\"%s\", new_student.country);     } while (strlen(new_student.country) == 0);     do     {         printf(\"Write the phone number of student\\n\");         scanf(\"%s\", new_student.phoneNumber);     } while (strlen(new_student.phoneNumber) != 13);     char* choose = (char*)malloc(255 * sizeof(char));     while (TRUE)     {         printf(\"Does student live in hostel? Y - yes, N - no\\n\");         scanf(\"%s\", choose);         if (strcmp(choose, \"y\") == 0 || strcmp(choose, \"Y\") == 0)         {             new_student.is_live_in_hostel = TRUE;             break;         }         if (strcmp(choose, \"n\") == 0 || strcmp(choose, \"n\") == 0)         {             new_student.is_live_in_hostel = FALSE;             break;         }     }     while (TRUE)     {         printf(\"Does student get scholarship? Y - yes, N - no\\n\");         scanf(\"%s\", choose);         if (strcmp(choose, \"y\") == 0 || strcmp(choose, \"Y\") == 0)         {             new_student.is_live_in_hostel = TRUE;             break;         }         if (strcmp(choose, \"n\") == 0 || strcmp(choose, \"n\") == 0)         {             new_student.is_live_in_hostel = FALSE;             break;         }     }     free(choose);     for (int i = 0; i &lt; 3; i++)     {         char temp[10];         printf(\"Write the %d mark of ZNO\\n\", i + 1);         scanf(\"%s\", temp);         new_student.mark_zno[i] = atof(temp);         if (new_student.mark_zno[i] == 0)         {             i--;         }     }      return new_student; }<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0410 \u0442\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c <code>Student.h<\/code> \u0438 <code>Student.c<\/code> \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u044b \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. <\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0430: \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0443\u0442\u0435\u0447\u0435\u043a \u043f\u0430\u043c\u044f\u0442\u0438. \u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0432 \u0433\u043e\u043b\u043e\u0432\u0443 \u2014 \u044d\u0442\u043e CRT. \u0422\u0443\u0442 \u0432\u0441\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e. <\/p>\n<p>  <\/p>\n<p>\u0412 \u043d\u0430\u0447\u0430\u043b\u043e \u0444\u0430\u0439\u043b\u0430, \u0433\u0434\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f main, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u0443\u0441\u043e\u043a \u043a\u043e\u0434\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">#define __CRTDBG_MAP_ALLOC #include &lt;crtdbg.h&gt; #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) #define new DEBUG_NEW<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410 \u043f\u0435\u0440\u0435\u0434 <code>return 0<\/code> \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u044d\u0442\u043e: <code>_CrtDumpMemoryLeaks();<\/code>. <\/p>\n<p>  <\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435, \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 Debug, \u0441\u0442\u0443\u0434\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u044d\u0442\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">Detected memory leaks!  Dumping objects -&gt; {79} normal block at 0x00A04410, 376 bytes long.  Data: &lt;                &gt; CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD  Object dump complete.<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u0443\u043f\u0435\u0440! \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435, \u0447\u0442\u043e \u0443 \u0432\u0430\u0441 \u0443\u0442\u0435\u0447\u043a\u0430 \u043f\u0430\u043c\u044f\u0442\u0438. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0440\u0430\u043d\u0438\u0442\u044c \u044d\u0442\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0437\u043d\u0430\u0442\u044c, \u0433\u0434\u0435 \u043c\u044b \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u044c. \u0418 \u0432\u043e\u0442 \u0442\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430: \u0430 \u0433\u0434\u0435, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432\u044b\u0434\u0435\u043b\u044f\u043b\u0430\u0441\u044c \u044d\u0442\u0430 \u043f\u0430\u043c\u044f\u0442\u044c? <\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/y4\/wb\/tz\/y4wbtze5lwwwph735qztx0kokaw.gif\"><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u044f \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u043b \u0432\u0441\u0435 \u0448\u0430\u0433\u0438, \u044f \u0432\u044b\u044f\u0441\u043d\u0438\u043b, \u0447\u0442\u043e \u043f\u0430\u043c\u044f\u0442\u044c \u0442\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u0433\u0434\u0435-\u0442\u043e \u0437\u0434\u0435\u0441\u044c:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">if (kX == 0)             {                 int sizeStudents = 0;                 struct Student* students = (struct Student*)malloc(1 * sizeof(struct Student));                 char* path = (char*)malloc(255 * sizeof(char));                 printf(\"Put the path to file with students: \");                 scanf(\"%s\", path);                 int size = 0;                 students = read_students(path, &amp;size);                 if (students == NULL)                 {                     printf(\"Can't open this file.\\n\");                 }                 else                 {                     for (int i = 0; i &lt; size; i++)                     {                         if (i == 0)                         {                             list = init(students[i]);                         }                         else                         {                             list = add_new_elem_to_start(list, students[i]);                         }                     }                 }                 free(students);                 printf(\"\\nPress any key to continue...\");                 getchar();                 getchar();                 free(path);             }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u043e \u043a\u0430\u043a \u0442\u0430\u043a \u2014 \u0442\u043e? \u042f \u0436\u0435 \u0432\u0441\u0435 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u044e? \u0418\u043b\u0438 \u043d\u0435\u0442?<\/p>\n<p>  <\/p>\n<p>\u0418 \u0442\u0443\u0442 \u043c\u043d\u0435 \u0441\u0438\u043b\u044c\u043d\u043e \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u043b\u043e Valgrind, \u0441 \u0435\u0433\u043e \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u043e\u0439 \u0432\u044b\u0437\u043e\u0432\u043e\u0432&#8230;<\/p>\n<p>  <\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435, \u043f\u043e\u0441\u043b\u0435 15 \u043c\u0438\u043d\u0443\u0442 \u043f\u0440\u043e\u0433\u0443\u0433\u043b\u0438\u0432\u0430\u043d\u0438\u044f, \u044f \u043d\u0430\u0448\u0435\u043b \u0430\u043d\u0430\u043b\u043e\u0433 Valgrind \u2014 <strong>Visual Leak Detector<\/strong>. \u042d\u0442\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u044f\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u043e\u0431\u0435\u0440\u0442\u043a\u0430 \u043d\u0430\u0434 CRT, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0431\u0435\u0449\u0430\u043b\u0430 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0443! \u042d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u043c\u043d\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0435\u0451 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u0432 <a href=\"https:\/\/github.com\/KindDragon\/vld\/releases\/tag\/v2.5.1\" rel=\"nofollow\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439<\/a> \u0438 \u0432 assets \u043d\u0430\u0439\u0442\u0438 <code>vld-2.5.1-setup.exe<\/code><\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0430\u0432\u0434\u0430, \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u0441\u043e \u0432\u0440\u0435\u043c\u0435\u043d Visual Studio 2015, \u043d\u043e \u043e\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u0441 Visual Studio 2019. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f, \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043b\u0435\u0434\u0443\u0439\u0442\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c VLD, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c <code>#include &lt;vld.h&gt;<\/code>. <\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u044d\u0442\u043e\u0439 \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 debug (F5), \u0438\u0431\u043e \u0432\u0441\u0435 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c. \u0412 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u044d\u0442\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">Visual Leak Detector read settings from: C:\\Program Files (x86)\\Visual Leak Detector\\vld.ini Visual Leak Detector Version 2.5.1 installed.<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u0432\u043e\u0442, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u0438 \u0443\u0442\u0435\u0447\u043a\u0435 \u043f\u0430\u043c\u044f\u0442\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">WARNING: Visual Leak Detector detected memory leaks! ---------- Block 1 at 0x01405FD0: 376 bytes ----------   Leak Hash: 0x555D2B67, Count: 1, Total 376 bytes   Call Stack (TID 8908):     ucrtbased.dll!malloc()     test.exe!0x00F41946()     test.exe!0x00F42E1D()     test.exe!0x00F44723()     test.exe!0x00F44577()     test.exe!0x00F4440D()     test.exe!0x00F447A8()     KERNEL32.DLL!BaseThreadInitThunk() + 0x19 bytes     ntdll.dll!RtlGetAppContainerNamedObjectPath() + 0xED bytes     ntdll.dll!RtlGetAppContainerNamedObjectPath() + 0xBD bytes   Data:     CD CD CD CD    CD CD CD CD    CD CD CD CD    CD CD CD CD     ........ ........     CD CD CD CD    CD CD CD CD    CD CD CD CD    CD CD CD CD     ........ ........     CD CD CD CD    CD CD CD CD    CD CD CD CD    CD CD CD CD     ........ ........     CD CD CD CD    CD CD CD CD    CD CD CD CD    CD CD CD CD     ........ ........     CD CD CD CD    CD CD CD CD    CD CD CD CD    CD CD CD CD     ........ ........     CD CD CD CD    CD CD CD CD    CD CD CD CD    CD CD CD CD     ........ ........     CD CD CD CD    CD CD CD CD    CD CD CD CD    CD CD CD CD     ........ ........     CD CD CD CD    CD CD CD CD    CD CD CD CD    CD CD CD CD     ........ ........     CD CD CD CD    CD CD CD CD    CD CD CD CD    CD CD CD CD     ........ ........     CD CD CD CD    CD CD CD CD    CD CD CD CD    CD CD CD CD     ........ ........     CD CD CD CD    CD CD CD CD    CD CD CD CD    CD CD CD CD     ........ ........     CD CD CD CD    CD CD CD CD    CD CD CD CD    CD CD CD CD     ........ ........     CD CD CD CD    CD CD CD CD    CD CD CD CD    CD CD CD CD     ........ ........     CD CD CD CD    CD CD CD CD    CD CD CD CD    CD CD CD CD     ........ ........     CD CD CD CD    CD CD CD CD    CD CD CD CD    CD CD CD CD     ........ ........     CD CD CD CD    CD CD CD CD    CD CD CD CD    CD CD CD CD     ........ ........  Visual Leak Detector detected 1 memory leak (412 bytes). Largest number used: 3115 bytes. Total allocations: 3563 bytes. Visual Leak Detector is now exiting.<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u043e\u0442, \u044f \u0432\u0438\u0436\u0443 \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0443! \u0422\u0430\u043a, \u0430 \u0433\u0434\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u043a\u043e\u0434\u0430? \u0410 \u0433\u0434\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439?<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/dz\/ui\/q8\/dzuiq8addahp5zcgp-p3nuarvqq.png\"><\/p>\n<p>  <\/p>\n<p>\u041b\u0430\u0434\u043d\u043e, \u043e\u0431\u0435\u0449\u0430\u043d\u0438\u0435 \u0441\u0434\u0435\u0440\u0436\u0430\u043b\u0438, \u043e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e \u043d\u0435 \u0442\u043e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0445\u043e\u0442\u0435\u043b.<\/p>\n<p>  <\/p>\n<p>\u041e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u043d\u0430\u0448\u0435\u043b \u0432 \u0433\u0443\u0433\u043b\u0435: \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u043d\u0438\u043c\u043e\u043a \u043f\u0430\u043c\u044f\u0442\u0438. \u041e\u043d \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e: \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 debug, \u043a\u043e\u0433\u0434\u0430 \u0434\u043e\u0445\u043e\u0434\u0438\u0442\u0435 \u0434\u043e return 0, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0438 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u0432\u043e \u0432\u043a\u043b\u0430\u0434\u043a\u0443 &#171;\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438&#187; \u0438 \u043d\u0430\u0436\u0430\u0442\u044c \u043d\u0430 &#171;\u0421\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043d\u0438\u043c\u043e\u043a&#187;. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0443 \u0432\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u044d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u0430\u043a \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0435. \u0422\u043e\u0433\u0434\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c, \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0434\u0435\u0431\u0430\u0433. <\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0435\u0440\u0432\u044b\u0439 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/8y\/e9\/0p\/8ye90pv8sqcl7ta-whe19khp5_a.jpeg\"><\/p>\n<\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0412\u0442\u043e\u0440\u043e\u0439 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ez\/ry\/z6\/ezryz6ugleg0jll99hb2pj65rmg.jpeg\"><\/p>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0441\u043d\u0438\u043c\u043e\u043a, \u0443 \u0432\u0430\u0441 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043f\u043e\u0434 \u043a\u0443\u0447\u0435\u0439 \u0440\u0430\u0437\u043c\u0435\u0440. \u042f \u0434\u0443\u043c\u0430\u044e, \u044d\u0442\u043e \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0441\u0435\u0433\u043e \u0431\u044b\u043b\u043e \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043e \u043f\u0430\u043c\u044f\u0442\u0438 \u0432 \u0445\u043e\u0434\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u041d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u043d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437\u043c\u0435\u0440. \u0423 \u043d\u0430\u0441 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043e\u043a\u043e\u0448\u043a\u043e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u044d\u0442\u043e\u0439 \u043a\u0443\u0447\u0435. \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0438 \u043d\u0430\u0436\u0430\u0442\u044c \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 &#171;\u042d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 Foo&#187;.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0422\u0440\u0435\u0442\u0438\u0439 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/10\/uh\/ms\/10uhmsb4afebqpruq1vlsnsp-mo.jpeg\"> <\/p>\n<\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0427\u0435\u0442\u0432\u0435\u0440\u0442\u044b\u0439 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/1j\/9o\/mt\/1j9omtinhnzrgtfbvmxalgs90f0.jpeg\"><\/p>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0414\u0430! \u042d\u0442\u043e \u043f\u043e\u0431\u0435\u0434\u0430! \u041f\u043e\u043b\u043d\u0430\u044f \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0430 \u0441 \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u0432\u044b\u0437\u043e\u0432\u043e\u0432! \u042d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e. <\/p>\n<p>  <\/p>\n<p><strong>Linux \u2014 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430<\/strong><br \/>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0442\u0432\u043e\u0440\u0438\u0442\u0441\u044f \u0432 Linux.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/xj\/zs\/m8\/xjzsm8buie-rrb4m66fristpsda.jpeg\"><br \/>  \u0412 Linux \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0443\u0442\u0438\u043b\u0438\u0442\u0430 valgrind. \u0427\u0442\u043e\u0431\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c valgrind, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c <code>sudo apt install valgrind<\/code> (\u0414\u043b\u044f Debian-\u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430). <\/p>\n<p>  <\/p>\n<p>\u042f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043c\u0430\u0441\u0441\u0438\u0432, \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c, \u043d\u0435 \u043e\u0447\u0438\u0449\u0430\u0435\u0442\u0441\u044f \u043f\u0430\u043c\u044f\u0442\u044c:<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">main.c<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">#include &lt;stdlib.h&gt; #include &lt;stdio.h&gt; #define N 10  int main() {     int * mas = (int *)malloc(N * sizeof(int));     for(int i = 0; i &lt; N; i++)     {         *(mas+i) = i;         printf(\"%d\\t\", *(mas+i));     }     printf(\"\\n\");     return 0; } <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0421\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e CLang, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c .out \u0444\u0430\u0439\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043f\u043e\u0434\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u043c valgrind&#8217;\u0443.<\/p>\n<p>  <\/p>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b <code>valgrind .\/a.out<\/code>. \u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 valgrind, \u0434\u0443\u043c\u0430\u044e, \u0435\u0441\u0442\u044c \u0441\u043c\u044b\u0441\u043b \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u0430 \u0441\u0435\u0439\u0447\u0430\u0441, \u043a\u0430\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430, valgrind \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u044d\u0442\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">==2342== HEAP SUMMARY: ==2342==     in use at exit: 40 bytes in 1 blocks ==2342==   total heap usage: 2 allocs, 1 frees, 1,064 bytes allocated ==2342==  ==2342== Searching for pointers to 1 not-freed blocks ==2342== Checked 68,984 bytes ==2342==  ==2342== LEAK SUMMARY: ==2342==    definitely lost: 40 bytes in 1 blocks ==2342==    indirectly lost: 0 bytes in 0 blocks ==2342==      possibly lost: 0 bytes in 0 blocks ==2342==    still reachable: 0 bytes in 0 blocks ==2342==         suppressed: 0 bytes in 0 blocks ==2342== Rerun with --leak-check=full to see details of leaked memory ==2342==  ==2342== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) ==2342== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, valgrind \u043f\u043e\u043a\u0430 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u043c\u044f\u0442\u0438 \u0431\u044b\u043b\u043e \u043f\u043e\u0442\u0435\u0440\u044f\u043d\u043e. \u0427\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0433\u0434\u0435 \u0431\u044b\u043b\u0430 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0430 \u043f\u0430\u043c\u044f\u0442\u044c, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c <code>--leak-check=full<\/code>, \u0438 \u0442\u043e\u0433\u0434\u0430, valgrind, \u043f\u043e\u043c\u0438\u043c\u043e \u0432\u044b\u0448\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e, \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u044d\u0442\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">==2348== 40 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==2348==    at 0x4C2FB0F: malloc (in \/usr\/lib\/valgrind\/vgpreload_memcheck-amd64-linux.so) ==2348==    by 0x40053A: main (in \/home\/hunterlan\/Habr\/a.out)<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0442\u0443\u0442 \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0430, \u043e\u0434\u043d\u0430\u043a\u043e \u0443\u0436\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u0447\u0442\u043e \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u0440\u0430\u0434\u043e\u0432\u0430\u0442\u044c. <\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u0442\u044c \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u044b valgrind\u2019\u0443, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a strace \u0438\u043b\u0438 Dr.Memory, \u043d\u043e \u044f \u0438\u043c\u0438 \u043d\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f, \u0434\u0430 \u0438 \u043e\u043d\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0442\u0430\u043c, \u0433\u0434\u0435 valgrind \u0431\u0435\u0441\u0441\u0438\u043b\u0435\u043d.<\/p>\n<p>  <\/p>\n<p><strong>\u0412\u044b\u0432\u043e\u0434\u044b<\/strong><\/p>\n<p>  <\/p>\n<p>\u042f \u0440\u0430\u0434, \u0447\u0442\u043e \u043c\u043d\u0435 \u0434\u043e\u0432\u0435\u043b\u043e\u0441\u044c \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u043f\u043e\u0438\u0441\u043a\u0430 \u0443\u0442\u0435\u0447\u043a\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u0432 Visual Studio, \u0442\u0430\u043a \u043a\u0430\u043a \u044f \u0443\u0437\u043d\u0430\u043b \u043c\u043d\u043e\u0433\u043e \u043d\u043e\u0432\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0433\u0434\u0430 \u0438 \u043a\u0430\u043a \u0438\u043c\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438 \u043d\u0430\u0447\u0430\u043b \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u044d\u0442\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b.<\/p>\n<p>  <\/p>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0432\u0430\u043c \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f, \u0443\u0434\u0430\u0447\u043d\u043e\u0433\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u0432\u0430\u043c!<\/p>\n<\/div>\n<p>               <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d() } } }t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>      <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/480368\/\"> https:\/\/habr.com\/ru\/post\/480368\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/480368\/\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/u4\/5k\/td\/u45ktd0wvbjglbnusjeg-pwyrmq.jpeg\"><\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e \u0432\u0430\u0441, \u0425\u0430\u0431\u0440\u043e\u0432\u0447\u0430\u043d\u0435!<\/p>\n<p>  <\/p>\n<p>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0445\u043e\u0447\u0443 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0441\u0432\u0435\u0442 \u043d\u0430\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u0431\u043e\u0440\u043e\u0442\u044c\u0441\u044f \u0441 \u0443\u0442\u0435\u0447\u043a\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0432 \u0421\u0438 \u0438\u043b\u0438 \u0421++.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430 \u0425\u0430\u0431\u0440\u0435 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u0432\u0435 \u0441\u0442\u0430\u0442\u044c\u0438, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e: <a href=\"https:\/\/habr.com\/ru\/post\/82514\/\">\u0411\u043e\u0440\u0435\u043c\u0441\u044f \u0441 \u0443\u0442\u0435\u0447\u043a\u0430\u043c\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 (C++ CRT)<\/a> \u0438 <a href=\"https:\/\/habr.com\/ru\/post\/113567\/\">\u0423\u0442\u0435\u0447\u043a\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u0432 \u0421++: Visual Leak Detector<\/a>. \u041e\u0434\u043d\u0430\u043a\u043e \u044f \u0441\u0447\u0438\u0442\u0430\u044e, \u0447\u0442\u043e \u043e\u043d\u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0440\u0430\u0441\u043a\u0440\u044b\u0442\u044b, \u0438\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u043c\u043e\u0433\u0443\u0442 \u043d\u0435 \u0434\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u0432\u0430\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043f\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u044b, \u0434\u0430\u0431\u044b \u043e\u0431\u043b\u0435\u0433\u0447\u0438\u0442\u044c \u0432\u0430\u043c \u0436\u0438\u0437\u043d\u044c. <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-296148","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/296148","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=296148"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/296148\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=296148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=296148"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=296148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}