memory-leaks

Puzzled over memory leaks in MFC project that disappear if _CrtDumpMemoryLeaks() is never called

只谈情不闲聊 提交于 2019-12-24 03:48:08
问题 I have an MFC (C++) dialog-based project that is compiled with Visual Studio 2017. I've added the following code to track for possible memory leaks as I build it: From within ProjectName.cpp before my CWinApp -derived class is initialized. #define _CRTDBG_MAP_ALLOC #include <stdlib.h> #include <crtdbg.h> #include <Wtsapi32.h> #pragma comment(lib, "Wtsapi32.lib") struct CatchMemLeaks{ CatchMemLeaks() { HANDLE ghDebugLogFile = ::CreateFile(L".\\dbg_output.txt", GENERIC_READ | GENERIC_WRITE,

Is is possible to have a clean undeploy in Glassfish?

不羁的心 提交于 2019-12-24 03:24:08
问题 I realized that any application which uses hibernate, fails to undeploy completely in Glassfish 2.1.1. Many classes remain in memory after the undeployment process, you can check it using jmap and jhat. I've done several tests, and figured out that only applications which had hibernate failed to have a clen undeploy process. My Database provider for Hibernate in all the cases were jTDS 1.2.5. You don't even need to run the application. If you just deploy, and instantly undeploy, you will

What diagnostic tools are available for Node.js applications?

我怕爱的太早我们不能终老 提交于 2019-12-24 03:14:10
问题 There are many tools out there, which diagnostics tools are good for diagnostic memory leak issues for node.js applications? 回答1: Yes, IDDE is a powerful tool not only for memory leak detection, but for a wide variety of problem determination of Node.js misbehaviors, including crashes and hangs. Here is the link for overview, installation, and what is new information: https://www.ibm.com/developerworks/java/jdk/tools/idde I would start with nodeoverview command. Note that every command starts

Memory Leak with SubstringWithRange NSString

血红的双手。 提交于 2019-12-24 02:18:13
问题 Running my program through the Leaks tool in X-Code, it points to this function as the main cause of my memory leaks. + (NSMutableArray *) getColumns:(NSString *) deviceHtml { NSMutableArray *ret = [[[NSMutableArray alloc] init] autorelease]; NSRegularExpression *m = [[NSRegularExpression alloc] initWithPattern:@"<td[\\w\\W\\d\\s</>]*?>[\\w\\W\\d\\s]+?</td>" options:NSRegularExpressionCaseInsensitive error:nil]; NSArray *results = [m matchesInString:deviceHtml options:NSMatchingCompleted

iOS 6 MKMapView Memory Leak and Crashes app after some time

喜你入骨 提交于 2019-12-24 02:14:48
问题 iOS 6 MKMapView seems to be using the tons of memory, when we starts zooming and playing around with the Map View in our application(for around 7-10 mins), When we come out of the controller which has MKMapView, its some how not releasing the total memory(I am using ARC in my App). I am allocating and initializing the MKMapView thru NIB. Controller 1 -->Controller 2 (has MKMapView) 1.5MB -->40-60MB (I have used the Instruments to find out leaks, but of no use) When i come back to Controller1

Memory consumption increases quickly, then drops very slowly; memory leak?

给你一囗甜甜゛ 提交于 2019-12-24 01:54:16
问题 I have this problem when running my program: The memory consumption increases pretty quickly when one of the functionalities of my program is running. I use Performance Monitor and Virtual Leak Detection, both say no leak. After the functionality is ended (program not exiting), the memory will slowly drops to normal level. Program is basically C#, WPF, C++; So when the memory consumption gets high, the hardware (motor), which my program drives, responses pretty sluggishly. I am very confused.

Is there any limitation for using MapViewOfFile?

两盒软妹~` 提交于 2019-12-24 01:48:12
问题 I am trying to use memory-mapped files as: hFile = ::CreateFile(State.Path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING,FILE_FLAG_SEQUENTIAL_SCAN, 0);//open the file if(hFile !=INVALID_HANDLE_VALUE){ hMap= ::CreateFileMapping(hFile, 0, PAGE_READONLY | SEC_COMMIT, 0, 0, 0);//create Mem mapping for the file in virtual memory if( hMap!=NULL){ base = ::MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0);//load the mapped file into the RAM //start to compare some bytes (values) from

How do you prevent leaks when raising an exception in init?

左心房为你撑大大i 提交于 2019-12-24 01:46:57
问题 Here's the situation. Let's say I have a class called MYFoo. Here's it's initializer: -init { self = [super init]; if (self) { // during initialization, something goes wrong and an exception is raised [NSException raise ...]; } return self; } Now somewhere else I want to use a MYFoo object, so I use a common pattern: MYFoo *foo = [[[MYFoo alloc] init] autorelease]; But what's going to happen is that, even if there's a try/catch around the 2nd part, a MYFoo object is going to be allocated, the

Memory leak when running python in Mac OS Terminal

我与影子孤独终老i 提交于 2019-12-24 00:57:26
问题 I just ran a python program in the Mac OS Terminal, and there is unusual memory leak. The program is simple like this: for i in xrange(1000000000, 2000000000, 10): i2 = i * i print i, i2, str(i2)[::2] if str(i2)[::2] == '1234567890': break When the program is running, it consumes more and more memory till it use up all my memory. When I terminate the program, my Terminal.app still consumes a lot of memory, so I guess it's a bug in Terminal.app? Does anyone have similar experience? 回答1: This

How can I get valgrind to tell me the address of each non-freed block of memory?

风格不统一 提交于 2019-12-24 00:53:52
问题 Valgrind tells me function xxx allocated memory which was not freed. Fine. It's proving more difficult than usual to trace however. To this end I have created numerous: #ifdef DEBUG fprintf(stderr, "something happening:%lx\n", (unsigned long)ptr); #endif So I just need to match these ptr addresses that are displayed with the addresses of non-freed memory. How can I get valgrind to tell me the address of each non-freed block of memory? 回答1: I don't believe Memcheck's leak checker supports