I overloaded the global operator new / delete / new [] / delete [], but simple tests show that although my versions new and delete are called correctly, they perform simple array allocations and are deleted using new [] and deleting [] calls in newaop.cpp and delete2.cpp.
For example, this code
int* a = new int[10];
calls the new [] operator in newaop.cpp, which in turn calls my version of the new operator. So it looks like they are overloaded globally, but for some reason are not versions of the array. Is something missing?
EDIT: My statement implementation is in a separate project, which is compiled into a library and linked to a static one. Looking back, it might be useful to include in the original post, as this probably has something to do with it. Although I still can not understand why only the versions of arrays are affected.
Well, I managed to crack it, so I'm sending messages if anyone else stumbles on this.
, , , , , . , , , .cpp ( ). , , . , Visual Studio, , newaop.cpp delete2.cpp . new [], delete [] (bot new/delete!). , , , .cpp .
, .
, operator new[], MSVC2008:
operator new[]
void* operator new[](size_t size) { return 0; } int main() { int* a = new int[5]; }
operator new[].
, : - operator new[], operator new[], operator new . operator new, .
operator new
new . new [] n n .
edit: [] [] . , ? ? , newaop delete2 in (.. exe)?
, , : vP. , int , size_t. , .
int
size_t
Source: https://habr.com/ru/post/1728834/More articles:Java ImageIO: Can I convert PNG-24 to PNG-8? - javaIs there a way to get full resolution contact photos on Android - androidDeserialize xml to Linq to SQL object - c #Как использовать колесико мыши в Squeak/Morphic GUI - user-interfaceThe easiest way to integrate a python gui application with a c console application - cКак заменить все не-буквы в заданной строке s символом '*' - javajQuery Toggle Show / Hide w / Multiple DIV IDs - jqueryWhat causes scheduled threads to not run in Java? - javaHow to print attribute value instead of element content? - xmlPOCO support in Entity framework - c #All Articles