resource-leak

Do I need a WOW64 dump for GDI Handle analysis?

邮差的信 提交于 2019-12-12 08:38:42
问题 I'm debugging a potential GDI Handle Leak. Thanks to @Alois Kraus, there is a WinDbg script which performs a handle count. From my debugging sessions, especially for .NET, I find that usually, it's better to have 32-bit dumps of 32-bit processes and 64-bit dumps of 64-bit processes. Unfortunately, with 2 crash dumps I received, the script does not work. Looking deeper into it, I found out that the GdiSharedHandleTable is null in those dumps: 0:000> dt ntdll!_PEB GdiSharedHandleTable @$peb

RestEasyClient JAX RS possible resource leak if not done correctly

放肆的年华 提交于 2019-12-11 14:57:11
问题 Issue: I had a rest client that was supposed to send request to a URL. The java application was a standalone java Application ( started with java -jar ) and then on exit all application context were closed. but the application would end but not shutdown and the PID remained for the java process. On each request I was doing an async call and getting the response in an InvocationCallback implementation. client = new ResteasyClientBuilder().connectTimeout(timeout, TimeUnit.SECONDS).readTimeout

Closing a Kafka connection

独自空忆成欢 提交于 2019-12-11 09:35:48
问题 I have an application that should send a finite number of messages to Kafka and then quit. For some reason, the Kafka connection stays up even if I close the producer. My implementation (in Scala) is more or less object Kafka { private val props = new Properties() props.put("compression.codec", DefaultCompressionCodec.codec.toString) props.put("producer.type", "sync") props.put("metadata.broker.list", "localhost:9092") props.put("batch.num.messages", "200") props.put("message.send.max.retries

Spring ClassPathResource(file).getInputStream() not releasing resource immediately

↘锁芯ラ 提交于 2019-12-11 08:35:15
问题 I've presented that problem as possible JDK bug: Is JDK ClassLoader.getResourceAsStream broken? (unclosed resources) I'm reading properties (with some interval) from file by: try (InputStream propertiesInputStream = new ClassPathResource(FILENAME).getInputStream()) { loadedProperties.load(propertiesInputStream); } but when I go to /proc/MY_PROCESS_ID/fd and list opened resources I see my FILENAME properties file opened even 100 times or more. This is risky as 1024 is default limit on most

Diagnosing RegisterWindowsMessage leak

百般思念 提交于 2019-12-11 06:06:42
问题 We are seeing atom pool resource exhaustion on production servers of one of our applications. Using the fantastic AtomTableMonitor tool, we've isolated the issue to creation of a huge number of atoms by the RegisterWindowsMessage call. They all have names like this: ControlOfs030D000000000270 where the number at the end changes. My question is: How do we figure out which process is creating these atoms? some potential resources: https://blogs.msdn.microsoft.com/ntdebugging/2012/01/31

How to trace handle leaks?

回眸只為那壹抹淺笑 提交于 2019-12-10 13:43:53
问题 In one of my applications I observe an increasing number of handles. The number is incremented roughly every second without using the application, so there must be a handle leak in some part of the background processing code. How can I trace such leaks? Are there any tools to help with this? What are the patterns to look for when tracing handle leaks? What are the most common mistakes that cause a handle leak? A bunch of questions, but I hope they are related enough to put them in one

Force warning when class is not closed

醉酒当歌 提交于 2019-12-10 12:53:33
问题 When I work with IO classes like java.util.Scanner or java.io.BufferedReader , Eclipse displays a warning Resource leak: 'suchAndSuch' is never closed . How can I make Eclipse display this warning for my own class when it is not closed? What I want to know is if there is an Interface or something I need to implement to make my class be treated like the IO classes, so that it's independent of any one IDE, e.g. the command line javac also displays a warning when a resource isn't closed. 回答1:

Is KillTimer necessary?

一曲冷凌霜 提交于 2019-12-08 17:41:38
问题 I use SetTimer API and I see a lot of code like this: case WM_DESTROY: // Destroy the timer. KillTimer(hwnd, IDT_TIMER); PostQuitMessage(0); break; Do I have to call KillTimer or the system will automatically free resources on the process exit? Does forgetting to call KillTimer lead to resource leaks? I understand that if the timer is not needed it CAN be destroyed by KillTimer. But MUST it be destroyed manually? 回答1: Timers set from HWNDs are implicitly destroyed by the window (hwnd) being

Is JDK ClassLoader.getResourceAsStream broken? (unclosed resources)

自作多情 提交于 2019-12-06 03:17:19
问题 I will try to prove that ClassLoader.getResourceAsStream() is opening two InputStreams , closing none of it and returning only one to client. Is my logic correct? JDK sources are picked from jdk1.8.0_25 I've get into unclosed resources problem using Spring ClassPathResource in interval (original question), that is using ClassLoader.getResourceAsStream to get InputStream to a properties file. After investigation, I found that classLoader.getResourceAsStream is getting an URL by URL url =

Using statement around dialog form to ensure garbage collection

痞子三分冷 提交于 2019-12-04 19:54:45
问题 We have a Windows Forms application that contains thousands of forms. Many of these are temporarily displayed as dialogs via the ShowDialog() method. This application has been around for years and we've discovered that many of the forms are not getting garbage collected in a timely manner due to various resource leaks in the form or the controls that it uses. Specifically, we've found examples of GDI+ resources that aren't being disposed of properly, although there may be other types of