Questions tagged [resource-leak]
208 questions
8
votes
2 answers
Do I need a WOW64 dump for GDI Handle analysis?
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…

Thomas Weller
- 55,411
- 20
- 125
- 222
8
votes
3 answers
Why does this code generate a "Potential resource leak" warning?
Eclipse (Juno) gives the following warning:
Potential resource leak: 'os' may not be closed
at the first line of the try body in this code:
static void saveDetails(byte[] detailsData) {
OutputStream os = null;
try {
os =…

Ted Hopp
- 232,168
- 48
- 399
- 521
7
votes
3 answers
How to trace handle leaks?
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…

jpfollenius
- 16,456
- 10
- 90
- 156
7
votes
4 answers
What's a good pattern for a java unit test that ensures that you are properly closing files?
I have an issue in my codebase where we are not properly closing file handles, or probably streams. We eventually get a TooManyOpenFiles exception under very heavy load. Based on the output of lsof, we are pretty sure we know where the leak is (in…

Mike Sokolov
- 6,914
- 2
- 23
- 31
7
votes
2 answers
Lwt leaking file descriptors, not sure if bug or my code
(Cross posted to lwt github issues)
I have boiled down my usage to this code sample which will leak file descriptors.
say you have:
#require "lwt.unix"
open Lwt.Infix
let echo ic oc = Lwt_io.(write_chars oc (read_chars ic))
let program =
let…
user1971598
7
votes
0 answers
On Crashlytics enabled, getting resource leaks
Hiii, I have added crashlytics for error reporting and when I enable strict mode, I am getting resource leaks. Any idea where I am wrong,
A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on…

Abhishek Patidar
- 1,557
- 1
- 16
- 25
7
votes
1 answer
socket handle leak in pyzmq?
Hi good people of StackOverflow.
I'm using pyzmq and I've got some long-running processes, which led to a discovery that socket handles are being left open. I've narrowed the offending code down to the following:
import zmq
uri =…

Cari
- 997
- 1
- 10
- 16
7
votes
3 answers
Will stream classes or connections considered as a resource leak in Java
Java has no lifetime for an object, this is managed by the garbage collector. And if I use some IO classes without closing it, or some DBConnection, will this considered a resource leak? In another words, will IO object be collected and destroyed by…

Joey.Z
- 4,492
- 4
- 38
- 63
6
votes
1 answer
Resource leak issues in Eclipse?
I made some tests (using Windows 7, Eclipse Juno 4.2.1 and Java 7 SE) and found that if a method did not explicitly return in the catch-block and if the object was declared outside the try/catch, then no "resource leak" warning was signaled.
Does…

mortensi
- 2,907
- 1
- 13
- 11
6
votes
2 answers
Is it possible to close a Reader without closing the stream?
I have a method which accepts an InputStream (of binary data) and serializes it to XML. In order to do so, it wraps the stream with a base64 encoder and a Reader to convert it to character data. However, since the InputStream is passed in as a…

Lucas
- 14,227
- 9
- 74
- 124
5
votes
0 answers
Is this a known GDI leak bug in .NET Framework/.NET Core/.NET 6?
I have a .NET Framework Console app (4.6.2 and 4.7.2 exhibit this issue). It opens a SaveFileDialog 5 times in a row, each time waiting for the previous dialog to close.
Looking at the GDI column in TaskManager, I'm seeing the GDI object count start…

pushkin
- 9,575
- 15
- 51
- 95
5
votes
0 answers
Firebase Strictmode resource leak
After converting from Crashlytics via Fabric to Crashlytics via Firebase, I started seeing the below call stack in debug runs where StrictMode is enabled looking for resource leaks.
StrictMode is in use with this code, only on debug…

SKOlson
- 367
- 2
- 13
5
votes
1 answer
What unnamed GDI resources could I be leaking
I ran an overnight stress test of my application, and when i came in this morning the software had crashed from a Windows error.
The error occurred because the process was obviously out of GDI handles:
Process Explorer
Task Manager
The next thing…

Ian Boyd
- 246,734
- 253
- 869
- 1,219
5
votes
3 answers
Hundreds of custom UserControls create thousands of USER Objects
I'm creating a dashboard application that shows hundreds of "items" on a FlowLayoutPanel.
Each "item" is a UserControl that is made up of 12 textboxes or labels.
My app queries a database and then creates an "item" instance for each record,…

Andy Blackman
- 1,235
- 1
- 11
- 14
5
votes
1 answer
Is there a difference in disposing Icon and Bitmap?
I was debugging resource leaks in my application and created a test app to test GDI object leaks. In OnPaint I create new icons and new bitmaps without disposing them. After that I check the increase of GDi objects in task manager for each of the…

username
- 3,378
- 5
- 44
- 75