473,803 Members | 3,899 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Undisposed instances of BinaryReader in localized forms

I've been trying out the .NET Memory Profiler
(http://www.scitech.se/memprofiler/) and I found an excessive number of
undisposed instances of BinaryReader after opening and then closing various
forms. The thing that these forms have in common is that they are localized
for both English and Dutch. I tried adding resources.Relea seAllResources( )
from the destructor but that had no effect. I'm pretty sure that it is the
localization code but of course I'm not totally sure, does anyone have any
more information about this, or perhaps what I can do to dispose all of the
BinaryReader instances? This application is designed to run 24/7 from the
system tray so its important to me to patch up any memory leaks.

Thanks,
Robert
Nov 16 '05 #1
4 1861
Hi Robert

You should not leave any release/free work to destructors!

The best way to keep resources free is to Close (eventually Dispose)
every Reader/Stream after its job is done.
If there are more instances of BinaryReader then you should keep
references of unclosed ones (in Array or List) till they will be
Closed.

Regards

Marcin

PS: You should close reader/stream in "finally" block.in case of
exception
I've been trying out the .NET Memory Profiler
(http://www.scitech.se/memprofiler/) and I found an excessive number of
undisposed instances of BinaryReader after opening and then closing various
forms. The thing that these forms have in common is that they are localized
for both English and Dutch. I tried adding resources.Relea seAllResources( )
from the destructor but that had no effect. I'm pretty sure that it is the
localization code but of course I'm not totally sure, does anyone have any
more information about this, or perhaps what I can do to dispose all of the
BinaryReader instances? This application is designed to run 24/7 from the
system tray so its important to me to patch up any memory leaks.

Thanks,
Robert

Nov 16 '05 #2
Hi Marcin-

Perhaps I should have clarified that BinaryReader isn't directly called
anywhere in my code - I'm assuming that the Windows
Form Designer localization code (from ResourceManager ) is calling it.

Robert
"Marcin Grzębski" <mg*******@taxu ssi.no.com.spam .pl> wrote in message
news:cd******** **@atlantis.new s.tpi.pl...
Hi Robert

You should not leave any release/free work to destructors!

The best way to keep resources free is to Close (eventually Dispose)
every Reader/Stream after its job is done.
If there are more instances of BinaryReader then you should keep
references of unclosed ones (in Array or List) till they will be
Closed.

Regards

Marcin

PS: You should close reader/stream in "finally" block.in case of
exception
I've been trying out the .NET Memory Profiler
(http://www.scitech.se/memprofiler/) and I found an excessive number of
undisposed instances of BinaryReader after opening and then closing various forms. The thing that these forms have in common is that they are localized for both English and Dutch. I tried adding resources.Relea seAllResources( ) from the destructor but that had no effect. I'm pretty sure that it is the localization code but of course I'm not totally sure, does anyone have any more information about this, or perhaps what I can do to dispose all of the BinaryReader instances? This application is designed to run 24/7 from the system tray so its important to me to patch up any memory leaks.

Thanks,
Robert

Nov 16 '05 #3
Hi Robert,

It looks like another .NET internal problem.

"ReleaseAllReso urces()" should work... but you'll never know.

hmmm... I can only recommend to get resources from out of
"InitializeComp onent()" in contructor ( TODO block ).
Then release them by "ReleaseAllReso urces()" at the end of
constructor.

If you are initializing more forms/controls/components then don't
forget to dispose them one by one at "the end".

Marcin

PS: Do you have memory-taking resources? Text & icons or
more?
Hi Marcin-

Perhaps I should have clarified that BinaryReader isn't directly called
anywhere in my code - I'm assuming that the Windows
Form Designer localization code (from ResourceManager ) is calling it.

Robert
"Marcin Grzębski" <mg*******@taxu ssi.no.com.spam .pl> wrote in message
news:cd******** **@atlantis.new s.tpi.pl...
Hi Robert

You should not leave any release/free work to destructors!

The best way to keep resources free is to Close (eventually Dispose)
every Reader/Stream after its job is done.
If there are more instances of BinaryReader then you should keep
references of unclosed ones (in Array or List) till they will be
Closed.

Regards

Marcin

PS: You should close reader/stream in "finally" block.in case of
exception

I've been trying out the .NET Memory Profiler
(http://www.scitech.se/memprofiler/) and I found an excessive number of
undisposed instances of BinaryReader after opening and then closing
various
forms. The thing that these forms have in common is that they are
localized
for both English and Dutch. I tried adding
resources.Relea seAllResources( )
from the destructor but that had no effect. I'm pretty sure that it is
the
localizati on code but of course I'm not totally sure, does anyone have
any
more information about this, or perhaps what I can do to dispose all of
the
BinaryRead er instances? This application is designed to run 24/7 from
the
system tray so its important to me to patch up any memory leaks.

Thanks,
Robert


Nov 16 '05 #4
Hi Marcin-

Yes, I've tried using ReleaseAllResou rces at the end of
InitializeCompo nent - but it didn't solve the BinaryReader problem. There
are quite a few memory-taking resources in the program, but I've taken a lot
of care to ensure that they're Disposed after they've been used.

Robert
"Marcin Grzębski" <mg*******@taxu ssi.no.com.spam .pl> wrote in message
news:cd******** **@atlantis.new s.tpi.pl...
Hi Robert,

It looks like another .NET internal problem.

"ReleaseAllReso urces()" should work... but you'll never know.

hmmm... I can only recommend to get resources from out of
"InitializeComp onent()" in contructor ( TODO block ).
Then release them by "ReleaseAllReso urces()" at the end of
constructor.

If you are initializing more forms/controls/components then don't
forget to dispose them one by one at "the end".

Marcin

PS: Do you have memory-taking resources? Text & icons or
more?
Hi Marcin-

Perhaps I should have clarified that BinaryReader isn't directly called
anywhere in my code - I'm assuming that the Windows
Form Designer localization code (from ResourceManager ) is calling it.

Robert
"Marcin Grzębski" <mg*******@taxu ssi.no.com.spam .pl> wrote in message
news:cd******** **@atlantis.new s.tpi.pl...
Hi Robert

You should not leave any release/free work to destructors!

The best way to keep resources free is to Close (eventually Dispose)
every Reader/Stream after its job is done.
If there are more instances of BinaryReader then you should keep
references of unclosed ones (in Array or List) till they will be
Closed.

Regards

Marcin

PS: You should close reader/stream in "finally" block.in case of
exception
I've been trying out the .NET Memory Profiler
(http://www.scitech.se/memprofiler/) and I found an excessive number of
undisposed instances of BinaryReader after opening and then closing


various
forms. The thing that these forms have in common is that they are


localized
for both English and Dutch. I tried adding


resources.Relea seAllResources( )
from the destructor but that had no effect. I'm pretty sure that it is


the
localizati on code but of course I'm not totally sure, does anyone have


any
more information about this, or perhaps what I can do to dispose all of


the
BinaryRead er instances? This application is designed to run 24/7 from


the
system tray so its important to me to patch up any memory leaks.

Thanks,
Robert


Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2192
by: Tonya | last post by:
Hi, Does anyone have any example of how i can manage forms in my application?? I want to be able to reference my form instances that are currently open from other forms. why cant i open and close forms as easily as in VB6??
1
1574
by: Bogdan Zamfir | last post by:
Hi, I have big troubles with an Access2002 application I wrote it under Acc2002 Romanian, and try to run it on Acc2002 US version, and I have the following troubles For some forms, Load event is not executed, and when the form is opened (it is, but without triggering any LOAD event) I try to click on any button, It gets a message like "Access cannot communicate with ActiveX server, bla, bla..."
0
1305
by: Robert Misiak | last post by:
Hi all- I'm trying to add Windows 98/ME support to an app that previously only supported Windows 2000+. My test box is a running 98 SE. I have a number of localized forms (translated for English (default) and Dutch), as well as two additional resource files that conatin various strings: Strings.resx and Strings.nl.resx. Everything works fine on Windows 2000 or XP. However, in 98 I get the English text regardless of what the...
1
1874
by: Bob | last post by:
I had developped a class in Vs2003 Vb.net that would give me localized project ressources (not form ressources, these were in the individual forms). I had two files MyProjectResources.resx and MyProjectResources.fr.resx, they were in the project folder topgether with all the forms and other files. The clas that worked fine in Vs2003 no longer works in Vs2003. It gives me a nothing value whenever I try to get a ressource string from the...
1
1997
by: cold80 | last post by:
I'm trying to understand how VS 2005 and the .NET Framework 2.0 can be used for a localized application. I've read a lot of messages, posts and guides but I can find a straight answer. I would like to write a DLL library, but I think it'll contain also some forms. I'd like to add a global resx file for all the error messages and a resource file for each form. This can be done very easily with VS2005. Then I can add a resource file for each...
0
1546
by: Joe | last post by:
Hi, what circumstances can lead to the situation (I currently have this situation, but I don't know why...) that the list of Localized Resources outputs (in a VS 2005 setup project, in the File System panel referencing the Localiced Recources from an other C# project which contains localized forms in 4 languages besides the default language) contains duplicate files (each resource file is duplicated)? What could prevent this behaviour? ...
5
3317
by: Neil | last post by:
"lyle" <lyle.fairfield@gmail.comwrote in message news:48c3dde7-07bd-48b8-91c3-e157b703f92b@f3g2000hsg.googlegroups.com... Question for you. I'm doing something similar, only, instead of opening the forms all at once, I'm opening them as needed. I have a main form with multiple records; and then I have a pop-up form that the user opens with button. The pop-up form contains one record relating to the current record in the main form (but...
1
1090
by: Jon Slaughter | last post by:
Can one extend the type itself and not just an instance of the type? So I have something, say, like public static DateTime RawRead(this DateTime i, Stream s) { BinaryReader b = new BinaryReader(s); i = DateTime.FromBinary(b.ReadInt64()); return i; }
10
1290
by: =?Utf-8?B?TmF2YW5lZXRoLksuTg==?= | last post by:
using(BinaryReader reader = new BinaryReader(new FileStream(filePathName, FileMode.Open))) { //do something here } I have seen this code in one of the discussion forum. In this will file stream instance supplied get disposed when BinaryReader disposes ? Thanks
0
9700
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10546
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10292
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10068
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9121
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7603
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6841
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4275
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2970
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.