adah1972 / nvwa Goto Github PK
View Code? Open in Web Editor NEWMy small collection of C++ utilities
License: zlib License
My small collection of C++ utilities
License: zlib License
Probably it is not a nvwa problem. But nvwa affects too. So I hope you can help me.
In MinGW application operators new/delete will not be replaced globally. So can't be catched new/delete calls in shared libraries (.dll). new/delete overloading applies only for application .exe file. I tried to ask this on StackOverflow but don't get answer.
Hi. In MinGW i have errors. Don't know how it fix. Maybe you have some ideas?
Thank you!
In file included from C:\Code\nvwa/debug_new.h:42,
from C:\Code\DllMain.cpp:4:
C:/mingw/mingw32/lib/gcc/i686-w64-mingw32/8.1.0/include/c++/ext/new_allocator.h: In member function '_Tp* __gnu_cxx::new_allocator<_Tp>::allocate(__gnu_cxx::new_allocator<_Tp>::size_type, const void*)':
C:\Code\nvwa/_nvwa.h:57:14: error: expected operator before 'nvwa'
#define NVWA nvwa
^~~~
In file included from C:/mingw/mingw32/lib/gcc/i686-w64-mingw32/8.1.0/include/c++/i686-w64-mingw32/bits/c++allocator.h:33,
from C:/mingw/mingw32/lib/gcc/i686-w64-mingw32/8.1.0/include/c++/bits/allocator.h:46,
from C:/mingw/mingw32/lib/gcc/i686-w64-mingw32/8.1.0/include/c++/string:41,
from C:\Code\MMM.h:3,
from C:\Code\DllMain.cpp:6:
C:/mingw/mingw32/lib/gcc/i686-w64-mingw32/8.1.0/include/c++/ext/new_allocator.h:111:37: error: expected ')' before 'nvwa'
return static_cast<_Tp*>(::operator new(__n * sizeof(_Tp)));
^
)
C:/mingw/mingw32/lib/gcc/i686-w64-mingw32/8.1.0/include/c++/ext/new_allocator.h:111:37: error: expected ';' before 'nvwa'
return static_cast<_Tp*>(::operator new(__n * sizeof(_Tp)));
^
;
C:/mingw/mingw32/lib/gcc/i686-w64-mingw32/8.1.0/include/c++/ext/new_allocator.h:111:60: error: expected type-specifier before ')' token
return static_cast<_Tp*>(::operator new(__n * sizeof(_Tp)));
^
In file included from C:\Code\nvwa/debug_new.h:42,
from C:\Code\DllMain.cpp:4:
C:/mingw/mingw32/lib/gcc/i686-w64-mingw32/8.1.0/include/c++/bits/stl_tempbuf.h: In function 'std::pair<_Tp*, int> std::get_temporary_buffer(std::ptrdiff_t)':
C:\Code\nvwa/_nvwa.h:57:14: error: expected operator before 'nvwa'
#define NVWA nvwa
^~~~
In file included from C:/mingw/mingw32/lib/gcc/i686-w64-mingw32/8.1.0/include/c++/memory:66,
from C:/mingw/mingw32/lib/gcc/i686-w64-mingw32/8.1.0/include/c++/thread:39,
from C:\Code\MMM.h:4,
from C:\Code\DllMain.cpp:6:
C:/mingw/mingw32/lib/gcc/i686-w64-mingw32/8.1.0/include/c++/bits/stl_tempbuf.h:94:45: error: expected ')' before 'nvwa'
_Tp* __tmp = static_cast<_Tp*>(::operator new(__len * sizeof(_Tp),
^
)
#ifdef _DEBUG
#include "nvwa/debug_new.h"
#endif
// On Init
#ifdef _DEBUG
fopen_s(&nvwa::new_output_fp, "c:\\tools\\leak.txt" , "w");
nvwa::new_autocheck_flag = false;
nvwa::new_verbose_flag = true;
#endif
// On destroy
#ifdef _DEBUG
nvwa::check_leaks();
#endif
hi,你好。我对内存泄漏感兴趣。
看了你debug_new这边文章,因为有些内容对我而言有点晦涩,想对比下中文版的文章再对比下。但是
关于的IBM中文网中已经找不到中文版本的链接了。
也想趁宝地再想问下业界有哪些更好的轮子吗?
您好 请教下 fc_queue之前的老接口是咋保证两个线程访问安全的?没太看懂
vs2017环境
代码中定义实现了
new相关
1:void* operator new(size_t size);
2:void* operator new[](size_t size);
3:void* operator new(size_t size, const char* file, unsigned int line)
4:void* operator new[](size_t size, const char* file, unsigned int line)
delete相关
1:void operator delete(void* p);
2:void operator delete[](void* p);
3:void* operator new(size_t size, const char* file, unsigned int line);
4:void* operator new[](size_t size, const char* file, unsigned int line);
宏定义了 #define new new(FILE,LINE)
所以new or new[] 的时候都会调用new 3 api 或者new 4 api
请问一下delete 有啥办法能让代码中delete obj 或者 delete[] obj的时候 自动调用 delete 3 api或者delete 4 api
Hello,
I am using debug_new.h for verifying memory leaks in a program of mine; and there were 2317 reported! with the message that was something like:
Leaked object at 0x7facced07e20 (size 48, 0x104c62c31)
After all those, a message said
*** 2317 leaks found
and then, I get 1642 messages saying
delete: freed 0x7facced38e00 (size 112, 115248 bytes still allocated)
So, I started looking for the source of leakage, and it seems to come from a Dynamic Library I am using. Since it is a closed API, I cannot really debug it. Is this normal behavior?
Any advice? I am not an advanced programmer, an I am not even sure what is going on.
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.