Форум программистов, компьютерный форум, киберфорум
С++ для начинающих
Войти
Регистрация
Восстановить пароль
Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 4.89/27: Рейтинг темы: голосов - 27, средняя оценка - 4.89
2 / 2 / 0
Регистрация: 28.03.2009
Сообщений: 61

Утечка памяти

09.05.2010, 19:32. Показов 5279. Ответов 10
Метки нет (Все метки)

Студворк — интернет-сервис помощи студентам
Доброго времени суток! Столкнулся с проблемой утечки памяти! Будь у меня маленькая программка, выловил бы легко, но в 2000 строк кода все не так просто(((... Долго гуглил, нашел 2 варианта решения проблем, или с помощью левого софта на изучение которого с моим английским(( уйдет многовато времени, или перегружать функции new и delete, на написание коих уйдет время, а до завтра мне необходимо уже выловить ошибку... Я примерно знаю, где она может быть, но чтоб убедиться мне нужна какая то утилитка или хз что, которая сможет показать размер программы в байтах, а не в в килобайтах как это делает Диспетчер задач винды, и чтоб я сидя в отладчике смог проконтролировать, где изменяется размер... Никто не подскажет, как это сделать, или же какой то софт для вылавливания этих утечек с инструкцией на русском...
0
IT_Exp
Эксперт
34794 / 4073 / 2104
Регистрация: 17.06.2006
Сообщений: 32,602
Блог
09.05.2010, 19:32
Ответы с готовыми решениями:

утечка памяти
Может кто-то проверить есть ли здесь утечка памяти? Мне почему-то кажется что есть. В задачи нужно когда пользователь сделал операции...

Утечка памяти?!
Джесс Либерти и Дэвид Хорват "Освой самостоятельно С++ за 24 часа", вырезка из листинга 15.4 (стр 233): Строка 26 - Утечка памяти?...

Утечка памяти
Доброго времени суток. Написал оконное приложение. Столкнулся с проблемой - утекает память. Какие есть средства, чтобы определить,...

10
1261 / 799 / 108
Регистрация: 16.09.2009
Сообщений: 2,010
09.05.2010, 19:44
Есть ли такие утилиты.
Там создавал подобную тему, когда - то.
0
Эксперт С++
2924 / 1274 / 114
Регистрация: 27.05.2008
Сообщений: 3,465
09.05.2010, 19:59
Ха, всего-то каких-то 2 тыс.строк? Мелочи...

Если разрабатываешь в MS Visual Studio:
Искать: утилиту Visual Leak Detector (гуглится) - использование крайне просто, сводится к включению одной строки в исходный файл.

Иначе:
Искать утилиту CppCheck (последняя версия у меня - 1.31) - тоже гуглится.

А на дальнейшее - совет: почитай, что такое "умные указатели" и используй их. Благо, теперь они включены и в проект нового Стандарта языка (надеюсь, это будет C++11) и уже поддержаны компиляторами GCC 4.5 и VC++ 2008 (с SP1) - 2010.
1
2 / 2 / 0
Регистрация: 28.03.2009
Сообщений: 61
09.05.2010, 20:03  [ТС]
Genius Ignat, Спасибо, покопаюсь, но все же если у кого то есть какие то ссылки нормальные, как для новичков, киньте плз...
0
Эксперт С++
 Аватар для CyBOSSeR
2348 / 1721 / 149
Регистрация: 06.03.2009
Сообщений: 3,675
09.05.2010, 20:10
savak, если в MSVS, то можно и без утилит:
C++
1
2
3
4
5
6
7
8
9
10
11
// Other headers
#include <crtdbg.h>
 
#define new new(_CLIENT_BLOCK, __FILE__, __LINE__)
 
// Other code
 
int main(){
  _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
  // Other code
}
По завершению выполнения программы в режиме отладки, получишь в Output Window отчет по утечкам памяти, если таковые были.
2
2 / 2 / 0
Регистрация: 28.03.2009
Сообщений: 61
09.05.2010, 20:26  [ТС]
CheshireCat, Умные указатели - вещь! Спаибо, почитаю, погуглю!

Добавлено через 7 минут
CyBOSSeR, Прога с и спользованием Winapi. Я нашел в какой функции утечка, сделал так
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Other headers
#include <crtdbg.h>
 
#define new new(_CLIENT_BLOCK, __FILE__, __LINE__)
 
// Other code
 
 
  while(!done)                                  
    {
        if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))   
        {
            if (msg.message==WM_QUIT)               
            {
                done=TRUE;                          
            }
            else                                    
            {
                TranslateMessage(&msg);             
                DispatchMessage(&msg);              
            }
        }
        else                                    
        {
            if ((active && !DrawGLScene()) || keys[VK_ESCAPE])  
            {
                done=TRUE;                          
            }
            else                                    
            {
                                _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
 
                ps.EulerStep(0.005);  // В этой функции утечка, но она вызывает дофига моих же функий и дальше с помощью диспетчера виноус у меня ничего не вышло обнаружить
                SwapBuffers(hDC);                   
            }
  // Other code
Но вылезло 117 ошибок...((( Когда поставил в точке входа в программу те же 117((
0
Эксперт С++
 Аватар для CyBOSSeR
2348 / 1721 / 149
Регистрация: 06.03.2009
Сообщений: 3,675
09.05.2010, 20:32
savak, _CrtSetDbgFlag нужно вставить в начале функции входа приложения (main, WinMain). Попробуй и приведи список ошибок компилятора.
0
2 / 2 / 0
Регистрация: 28.03.2009
Сообщений: 61
09.05.2010, 20:47  [ТС]
List errors
1>c:\program files\microsoft visual studio 9.0\vc\include\xdebug(32) : warning C4229: anachronism used : modifiers on data are ignored
1>c:\program files\microsoft visual studio 9.0\vc\include\xdebug(32) : error C2365: 'operator new' : redefinition; previous definition was 'function'
1>c:\program files\microsoft visual studio 9.0\vc\include\xdebug(32) : error C2491: 'new' : definition of dllimport data not allowed
1>c:\program files\microsoft visual studio 9.0\vc\include\xdebug(32) : error C2078: too many initializers
1>c:\program files\microsoft visual studio 9.0\vc\include\xdebug(32) : error C2440: 'initializing' : cannot convert from 'int' to 'void *'
1> Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
1>c:\program files\microsoft visual studio 9.0\vc\include\xdebug(32) : error C2143: syntax error : missing ';' before '('
1>c:\program files\microsoft visual studio 9.0\vc\include\xdebug(32) : error C2226: syntax error : unexpected type 'size_t'
1>c:\program files\microsoft visual studio 9.0\vc\include\xdebug(33) : error C2059: syntax error : ')'
1>c:\program files\microsoft visual studio 9.0\vc\include\xdebug(36) : warning C4229: anachronism used : modifiers on data are ignored
1>c:\program files\microsoft visual studio 9.0\vc\include\xdebug(36) : error C2365: 'operator new' : redefinition; previous definition was 'function'
1>c:\program files\microsoft visual studio 9.0\vc\include\xdebug(36) : error C2491: 'new' : definition of dllimport data not allowed
1>c:\program files\microsoft visual studio 9.0\vc\include\xdebug(36) : error C2078: too many initializers
1>c:\program files\microsoft visual studio 9.0\vc\include\xdebug(36) : error C2440: 'initializing' : cannot convert from 'int' to 'void *'
1> Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
1>c:\program files\microsoft visual studio 9.0\vc\include\xdebug(36) : error C2143: syntax error : missing ';' before '['
1>c:\program files\microsoft visual studio 9.0\vc\include\xdebug(36) : error C3409: empty attribute block is not allowed
1>c:\program files\microsoft visual studio 9.0\vc\include\xdebug(36) : error C2226: syntax error : unexpected type 'size_t'
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(143) : error C2059: syntax error : 'constant'
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(144) : error C2091: function returns function
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(144) : error C2802: static member 'operator new' has no formal parameters
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(144) : error C2333: 'std::locale::facet::operator new' : error in function declaration; skipping function body
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(149) : error C2059: syntax error : 'constant'
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(151) : error C2091: function returns function
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(151) : error C2556: 'void *(__cdecl *std::locale::facet::operator new(void))(size_t,const std::_DebugHeapTag_t &,char *,int)' : overloaded function differs only by return type from 'void *(__cdecl *std::locale::facet::operator new(void))(size_t)'
1> c:\program files\microsoft visual studio 9.0\vc\include\xlocale(143) : see declaration of 'std::locale::facet::operator new'
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(152) : error C2059: syntax error : 'return'
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(152) : error C2238: unexpected token(s) preceding ';'
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(155) : error C2628: 'std::locale::facet' followed by 'void' is illegal (did you forget a ';'?)
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(157) : error C2487: 'delete' : member of dll interface class may not be declared with dll interface
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(157) : error C2817: return type for 'operator delete' must be 'void'
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(157) : error C2333: 'std::locale::operator delete' : error in function declaration; skipping function body
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(162) : error C2487: 'delete' : member of dll interface class may not be declared with dll interface
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(169) : error C2523: 'std::locale::~facet' : destructor tag mismatch
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(170) : error C2487: '{dtor}' : member of dll interface class may not be declared with dll interface
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(174) : error C2590: 'facet' : only a constructor can have a base/member initializer list
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(174) : error C2487: 'std::locale::{ctor}' : member of dll interface class may not be declared with dll interface
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(186) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(186) : warning C4183: 'facet': missing return type; assumed to be a member function returning 'int'
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(187) : error C2143: syntax error : missing ';' before '&'
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(187) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(187) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(187) : error C2143: syntax error : missing ',' before '&'
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(187) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(119) : error C2327: 'std::locale::_Refs' : is not a type name, static, or enumerator
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(119) : error C2065: '_Refs' : undeclared identifier
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(120) : error C2327: 'std::locale::_Refs' : is not a type name, static, or enumerator
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(120) : error C2065: '_Refs' : undeclared identifier
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(127) : error C2327: 'std::locale::_Refs' : is not a type name, static, or enumerator
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(127) : error C2065: '_Refs' : undeclared identifier
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(127) : error C2327: 'std::locale::_Refs' : is not a type name, static, or enumerator
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(127) : error C2065: '_Refs' : undeclared identifier
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(128) : error C2327: 'std::locale::_Refs' : is not a type name, static, or enumerator
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(128) : error C2065: '_Refs' : undeclared identifier
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(129) : error C2327: 'std::locale::_Refs' : is not a type name, static, or enumerator
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(129) : error C2065: '_Refs' : undeclared identifier
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(163) : error C2059: syntax error : ')'
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(197) : error C2504: 'facet' : base class undefined
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(207) : error C2061: syntax error : identifier 'facet'
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(222) : error C2061: syntax error : identifier 'facet'
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(228) : error C2061: syntax error : identifier 'category'
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(231) : error C2061: syntax error : identifier 'category'
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(235) : error C2061: syntax error : identifier 'category'
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(239) : error C2061: syntax error : identifier 'category'
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(241) : error C2143: syntax error : missing ';' before '*'
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(241) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(241) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(243) : error C2146: syntax error : missing ';' before identifier '_Catmask'
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(243) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(243) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(212) : error C2065: 'none' : undeclared identifier
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(213) : error C2614: 'std::_Locimp' : illegal member initialization: '_Catmask' is not a base or member
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(213) : error C2614: 'std::_Locimp' : illegal member initialization: '_Facetvec' is not a base or member
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(213) : error C2614: 'std::_Locimp' : illegal member initialization: 'facet' is not a base or member
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(217) : error C2039: '_Catmask' : is not a member of 'std::_Locimp'
1> c:\program files\microsoft visual studio 9.0\vc\include\xlocale(196) : see declaration of 'std::_Locimp'
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(218) : error C2614: 'std::_Locimp' : illegal member initialization: '_Catmask' is not a base or member
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(218) : error C2614: 'std::_Locimp' : illegal member initialization: '_Facetvec' is not a base or member
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(218) : error C2614: 'std::_Locimp' : illegal member initialization: 'facet' is not a base or member
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(224) : error C2065: '_Pfacet' : undeclared identifier
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(224) : error C2065: '_Id' : undeclared identifier
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(259) : error C2065: 'facet' : undeclared identifier
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(259) : error C2065: '_Fac' : undeclared identifier
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(259) : error C2275: 'size_t' : illegal use of this type as an expression
1> c:\documents and settings\virex\мои документы\visual studio 2008\projects\coursework2\coursework2\pr edefined c++ types (compiler internal)(19) : see declaration of 'size_t'
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(259) : error C2146: syntax error : missing ')' before identifier '_Id'
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(259) : error C2078: too many initializers
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(259) : error C2275: 'size_t' : illegal use of this type as an expression
1> c:\documents and settings\virex\мои документы\visual studio 2008\projects\coursework2\coursework2\pr edefined c++ types (compiler internal)(19) : see declaration of 'size_t'
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(260) : error C2059: syntax error : ')'
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(261) : error C2143: syntax error : missing ';' before '{'
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(261) : error C2447: '{' : missing function header (old-style formal list?)
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(286) : error C2270: '()' : modifiers not allowed on nonmember functions
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(286) : error C2801: 'std::operator ()' must be a non-static member
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(304) : error C2270: 'combine' : modifiers not allowed on nonmember functions
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(307) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(307) : error C2904: 'locale' : name already used for a template in the current scope
1> c:\program files\microsoft visual studio 9.0\vc\include\xlocale(62) : see declaration of 'std::locale'
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(323) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(323) : error C3861: '_Init': identifier not found
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(324) : error C2550: 'std::locale' : constructor initializer lists are only allowed on constructor definitions
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(325) : error C2227: left of '->_Incref' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(325) : error C3861: '_Getgloballocale': identifier not found
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(326) : warning C4508: 'std::locale' : function should return a value; 'void' return type assumed
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(329) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(330) : warning C4508: 'std::locale' : function should return a value; 'void' return type assumed
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(332) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(332) : error C2143: syntax error : missing ',' before '&'
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(333) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(333) : error C2065: '_Right' : undeclared identifier
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(333) : error C2228: left of '._Ptr' must have class/struct/union
1> type is ''unknown-type''
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(334) : error C2550: 'std::locale' : constructor initializer lists are only allowed on constructor definitions
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(335) : error C2227: left of '->_Incref' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(336) : warning C4508: 'std::locale' : function should return a value; 'void' return type assumed
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(338) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(338) : error C2143: syntax error : missing ',' before '&'
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(340) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(340) : error C2084: function 'int std::locale(const int) throw()' already has a body
1> c:\program files\microsoft visual studio 9.0\vc\include\xlocale(332) : see previous definition of 'locale'
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(340) : error C2061: syntax error : identifier '_DebugHeapTag_func'
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(340) : error C2612: trailing 'identifier' illegal in base/member initializer list
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(340) : error C2550: 'std::locale' : constructor initializer lists are only allowed on constructor definitions
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(340) : error C2065: '_Loc' : undeclared identifier
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(340) : error C2228: left of '._Ptr' must have class/struct/union
1> type is ''unknown-type''
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(340) : error C2059: syntax error : ')'
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(341) : error C2143: syntax error : missing ';' before '{'
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(343) : error C2065: '_Loc' : undeclared identifier
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(343) : error C2228: left of '._Ptr' must have class/struct/union
1> type is ''unknown-type''
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(343) : error C2227: left of '->_Catmask' must point to class/struct/union/generic type
1>c:\program files\microsoft visual studio 9.0\vc\include\xlocale(343) : error C2065: '_Loc' : undeclared identifier


эмммм.. вотъ
0
Эксперт С++
 Аватар для CyBOSSeR
2348 / 1721 / 149
Регистрация: 06.03.2009
Сообщений: 3,675
09.05.2010, 21:01
savak, по ходу, ты что то не туда куда надо вставил. Должно все работать.
0
2 / 2 / 0
Регистрация: 28.03.2009
Сообщений: 61
09.05.2010, 21:19  [ТС]
C++
1
2
3
4
5
6
7
8
#include <windows.h>        
#include <GL\gl.h>
#include <GL\glu.h>
#include <tchar.h>
#include <time.h>
#include <crtdbg.h>
 
#define new new(_CLIENT_BLOCK, __FILE__, __LINE__)

C++
1
2
3
4
5
6
int WINAPI WinMain( HINSTANCE   hInstance,          
                    HINSTANCE   hPrevInstance,      
                    LPSTR       lpCmdLine,          
                    int         nCmdShow)           
{
    _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
вот так вставил...
0
PB
Просто прогер
1292 / 1079 / 13
Регистрация: 13.03.2009
Сообщений: 2,502
09.05.2010, 21:22
Утечка памяти может так же происходить, если забыть освобождать хендлы, контексты и т. д.
0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
BasicMan
Эксперт
29316 / 5623 / 2384
Регистрация: 17.02.2009
Сообщений: 30,364
Блог
09.05.2010, 21:22
Помогаю со студенческими работами здесь

Утечка памяти
Взял листинг кода из книги Стивен Прата Язык программирования С++. Меня терзают смутные сомнения нет ли здесь утечки памяти, указатель ...

Утечка памяти
В небольшой программе с использованием OpenCV происходит утечка памяти, с чем связана не понимаю, прошу помощи, спасибо! #include...

утечка памяти
есть функция генерирующая массив из строк, которые могут быть составлены из символов alph. При length = даже 7 расходуется более 5гб...

Утечка памяти
Привет! написал программму, и не могу разобраться где утекает память. помогите кто сможет. Задание #include &lt;iostream&gt;...

Утечка памяти
Где я допустил ее(утечку)? #define _CRT_SECURE_NO_WARNINGS #include &lt;iostream&gt; #include &lt;cstring&gt; #include &lt;string&gt; ...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
11
Ответ Создать тему
Новые блоги и статьи
Thinkpad X220 Tablet — это лучший бюджетный ноутбук для учёбы, точка.
Programma_Boinc 23.12.2025
Рецензия / Мнение/ Перевод Нашел на реддите интересную статью под названием The Thinkpad X220 Tablet is the best budget school laptop period . Ниже её машинный перевод. Thinkpad X220 Tablet —. . .
PhpStorm 2025.3: WSL Terminal всегда стартует в ~
and_y87 14.12.2025
PhpStorm 2025. 3: WSL Terminal всегда стартует в ~ (home), игнорируя директорию проекта Симптом: После обновления до PhpStorm 2025. 3 встроенный терминал WSL открывается в домашней директории. . .
Как объединить две одинаковые БД Access с разными данными
VikBal 11.12.2025
Помогите пожалуйста !! Как объединить 2 одинаковые БД Access с разными данными.
Новый ноутбук
volvo 07.12.2025
Всем привет. По скидке в "черную пятницу" взял себе новый ноутбук Lenovo ThinkBook 16 G7 на Амазоне: Ryzen 5 7533HS 64 Gb DDR5 1Tb NVMe 16" Full HD Display Win11 Pro
Музыка, написанная Искусственным Интеллектом
volvo 04.12.2025
Всем привет. Некоторое время назад меня заинтересовало, что уже умеет ИИ в плане написания музыки для песен, и, собственно, исполнения этих самых песен. Стихов у нас много, уже вышли 4 книги, еще 3. . .
От async/await к виртуальным потокам в Python
IndentationError 23.11.2025
Армин Ронахер поставил под сомнение async/ await. Создатель Flask заявляет: цветные функции - провал, виртуальные потоки - решение. Не threading-динозавры, а новое поколение лёгких потоков. Откат?. . .
Поиск "дружественных имён" СОМ портов
Argus19 22.11.2025
Поиск "дружественных имён" СОМ портов На странице: https:/ / norseev. ru/ 2018/ 01/ 04/ comportlist_windows/ нашёл схожую тему. Там приведён код на С++, который показывает только имена СОМ портов, типа,. . .
Сколько Государство потратило денег на меня, обеспечивая инсулином.
Programma_Boinc 20.11.2025
Сколько Государство потратило денег на меня, обеспечивая инсулином. Вот решила сделать интересный приблизительный подсчет, сколько государство потратило на меня денег на покупку инсулинов. . . .
Ломающие изменения в C#.NStar Alpha
Etyuhibosecyu 20.11.2025
Уже можно не только тестировать, но и пользоваться C#. NStar - писать оконные приложения, содержащие надписи, кнопки, текстовые поля и даже изображения, например, моя игра "Три в ряд" написана на этом. . .
Мысли в слух
kumehtar 18.11.2025
Кстати, совсем недавно имел разговор на тему медитаций с людьми. И обнаружил, что они вообще не понимают что такое медитация и зачем она нужна. Самые базовые вещи. Для них это - когда просто люди. . .
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2025, CyberForum.ru