What Is The Effective Way To Reduce The Memory Consumption

Apr 5, 2011

I found what seems to be an easy and effective way to reduce the memory consumption of my vb.net app. What I need to know is how "correct" or "proper" is the method I'm using for my application and what exactly is going on behind the scenes that I should worry about? I want to release memory every time a form closes. Here is how I reduce the required memory of my program:[code...]

View 7 Replies


ADVERTISEMENT

.NET WinForm Memory Consumption?

Apr 19, 2011

I've been profiling a WinForm's application using ".NET Memory Profiler".I can't quite seem to understand how my application is growing to 1GB, then 2GB, then 3GB of usage - according to windows task manager.

The private bytes using that tool, and "Total Bytes in All Heaps" shows only as 70MB or so. At the top of my list of instances hanging around, they are mostly String, or WeakReferences to lots of little objects.

All the application is doing is showing a form that loads data from a database. I repeat the show/dispose cycle of the form about 100 times and the growth is continuous.I've tried about 3 memory profiling tools now and none of them are showing me where this enormous amount of memory consumption is coming from.

View 3 Replies

For Each Loop Enumerator Expression And Memory Consumption

Aug 15, 2011

According to the language specification guide for VB.NET Section 10.9.3. The enumerator expression in a for each loop is copied over into memory. If I have a list of 10000 objects that list will be in memory twice for the code below?
dim myList as new list(of bobs)
'put 10000 bobs in my list
for each x In myList
'do something
next

If I were generating the list from a linqQuery or some other such query it would make sense to generate that list at the for each loop statement thus not having the list in memory twice for example.
for each x in myList.where(function(x) x.name = Y)
'do something
next

If the LINQ query is unreadable on the for each loop, do I forgo readability and just put it on the for each loop declaration line? Should I declare the list in its own variable and just bite the bullet and have the list exist twice in memory?

View 1 Replies

Measuring Memory Consumption Of A Function That Accesses A Database?

Sep 16, 2011

I have a VB Function (in Visual Studio 2008 with .NET 3.5) that opens up a connection to an Oracle database and queries the database for information. Apparently after some trial and error, I discovered when the SQL statement is being processed and filling the dataset, it apparently is taking up too much memory trying to complete the task. I'm running into System.OutofMemory exceptions and other unpleasantness.I'm wondering, is there some sort of program out there to measure memory consumption of your SQL code that is being processed in a Visual Studio application?

View 1 Replies

Measuring Memory Consumption Of Function That Accesses Database

Aug 25, 2009

I have a VB Function (in Visual Studio 2008 with .NET 3.5) that opens up a connection to an Oracle database and queries the database for information. Apparently after some trial and error, I discovered when the SQL statement is being processed and filling the dataset, it apparently is taking up too much memory trying to complete the task.I'm running into System.OutofMemory exceptions and other unpleasantness.I'm wondering, is there some sort of program out there to measure memory consumption of your SQL code that is being processed in a Visual Studio application?

View 2 Replies

VS 2008 - Normal Versus MDI Form (Memory Consumption)

Mar 11, 2010

I did a project (College Management) in vb.net 2008 which contains 13 forms in it. I designed the different functions in a different normal form, i.e. frmAdmission, frmSearch etc. When the project run's the main form is loaded. When user chooses a particular function say 'frmSearch' then the main form is unloaded and the form frmSearch is loaded. Now my lecturer told me to use MDI forms instead of normal forms because, normal forms takes larger memory than the MDI forms.

View 5 Replies

Reduce Memory In Windows Application?

Sep 24, 2010

I am working on VB.net multiuser application and when ever my any form open up memory rise and after some time out of memory exception is come.

I am working on VB.net 2008 and sqlserver 2005. I have use very much of shared object so second time it memory allocation is less, but how i can reduce it when form is close or not in use. can i use Garbage collector or Dispose and how i use this functionality ?

View 3 Replies

Will Re-using Command Object Reduce Memory Usage

Mar 10, 2012

i wanna know for example if you have a few functions that actually creates a new sqlcommand in it and disposes them after use or is it better to have an sqlcommand at the main function and pass the sqlcommand in byref . and after using it. Juz clear the commandtext and the parameters.[code]

View 14 Replies

Reduce The Memory Usage Forcing To Garbage Collector To Collect With The Method?

May 1, 2012

I have a problem with an application, in this case I have a windows services. its function is generate reports depending of demand of our users.In some cases the memory usage of my windows services is to 2 gb of RAM. I disposed all objects that my application use . but the memory usage doesn't low.I tried to reduce the memory usage forcing to garbage collector to Collect with the method "GC.Collect"but it's not recommend because uses many time of CPU.Surfing on the internet I found a method named "SetProcessWorkingSetSize" that free memory usage correctly. http:[url]....but some cases my windows services named sapdkadm_procesoestandarejecucion.exe has some error message in event viewer is the next:

Faulting application sapdkadm_procesoestandarejecucion.exe, version 1.0.0.0, stamp 4f908fef, faulting module kernel32.dll, version 5.2.3790.4480, stamp 49c51cdd, debug? 0, fault address 0x0000000000027ded.

The real problem is that when this happens my windows services restart

View 3 Replies

Monitor The Power Consumption?

Sep 18, 2009

I am looking to record information about the computers power consumption over time, is there any way I could do this using vb, I can get the current voltage from the processor but do not know the current therefore can not work out the wattage. I know of application which do have power consumption recorders but I would like to create my own.

View 1 Replies

C# - Developing An Effective Barcode System / Code

Jun 15, 2012

I'm sorry if the title is misleading but I have to develop the format for a barcode (either 1D or 2D, doesn't matter). The barcode needs to include a Purchase Order #, Bill of lading #, as well as the Line #, product ID # and quantity of each item that appears on the purchase order. Here is what I've come up with so far:

[Code]...

View 2 Replies

C# - Most Optimized/effective Way To Convert A Collection Into An Array?

Jul 6, 2010

I have a collection which I wish to retrieve an array from in .NET 2.0. In other words, I want to convert a collection into an array. So far I have the following:

Public Class Set(Of T)
Implements IEnumerable(Of T)
Implements ICollection(Of T[code]....

View 2 Replies

Event Consumption For Concurrency In A Multicore Application?

Jan 18, 2010

Target machine 4 core AMD I have an event that is raised my the main thread of the application. The event is consumed by several different classes in the application. I want them all to run concurrently up to the max cores available and then que the rest in order.The work routine in each class is relatively small but concurrency is the goal.Considering this.

A. Create a background worker on each classes initialization and have the event handler start the worker.

B. Create a delegate to the do-work sub that is called by the event handler

A- Pros - worker is only created once and reusable so only pay creation cost once.

A-Cons could create a ton of workers that consume resources eventually.

B- Pros Smaller thread pool

B- Cons Lot of overhead

View 2 Replies

Provide An Effective Way For Application To Get Registered Automatically?

Apr 30, 2009

I would like to provide an effective way for my VB.NET application to get registered automatically in a company with many computers. So the Enterprise Licence would kick in, but how to manage this?I was thinking each computer would connect to an intranet server where he would get the permission to register...C64

View 2 Replies

Effective Ways Of Game Making And Graphic Usage

May 19, 2009

I've not really got a lot of experience making any games, but currently I've only made small basic games which involve, moving picture boxes with Case (KeyDown) events and timers etc, I've noticed a few problems such as, flickering and jittery movements as it += on to Top or left. Especially when I try it on other computers it varies and is sometimes really bad. I've heard from my lecturer that you can use other things in VB.NET such as GDI+ or GDK or whatever, I'm not really sure, but would someone be able to explain to me what other ones there are for VB.NET or the best method for me to do to move on to more effective ways of creating a graphical interface.

View 2 Replies

Save Word Document In A Different Format Without Effective Active?

May 18, 2012

Is there a way in VB.net to save a Word document as a different format (i.e. Me.Application.ActiveDocument.SaveAs) without switching to it? For example, if the current document is an unsaved, I want to save an copy of that document as HTML but still keep the unsaved document active.

View 1 Replies

Word Macro - Auto List Of Effective Pages?

May 16, 2011

When writing a manual in word I can create table of content. How can I get list of effective pages LEP with possible a loop checking for pagenumber & date then adding data to a table on a page in Word with VBA code/macro?

View 2 Replies

DB/Reporting :: Searching For More Effective Data Storage For Quick Access?

May 12, 2008

I am quite green to VB .NET and it start occuring to me that I am doing things probably in a very ineffective way.Anyway here is the problem I have datasets, consisting of integers there is set 1 which is of format ID, ID2 - ID here is unique but different ID can refer to same ID2. Before I start reading in the data I have unknown number of these entries (ID and ID2 can be at least as high as 99999999)

Then I have a second data set of format ID2 here is the same as in the set 1 and it can contain several PID entries (all integers). In this set the ID2 is unique and again for one ID2 there can be unknown amount of these PIDs, same PID can occur more than once.

[Code]...

View 17 Replies

Wpf - Effective Books For Learning The Intricacies Of Business Application Development?

May 24, 2010

I am a self taught "developer".I use the term loosely because I only know enough to make myself dangerous. I have no theory background, and I only pick up things to get this little tool to work or make that control do what I want.

That said, I am looking for some reading material that explains some of the theory behind application development especially from a business standpoint. Really I need to understand what all of these terms that float around really talk about. Business Logic Layer, UI abstraction level and all that. Anyone got a reading list that they feel helped them understand this stuff? I know how to code stuff up so that it works. It is not pretty mostly because I don't know the elegant way of doing it, and it is not planned out very well (I also don't know how to plan an application).

View 3 Replies

VS 2005 Display In A Datagrid Total Consumption Of Gas (litres) With Kilometers Driven (mileage) Between 2 Dates

Aug 29, 2011

i am doing a small project for my business and i got stuck with this 2 weeks ago and still no progress.I have an access db table "store" that has columns: (filldate,brand,model,plateno,mileage,litres) where i am storing these info each time a car in my company fills gas. For example8/25/2011,Renault,Megane,5487844,3943,20).What i want to do now is to display in a datagrid the total consumption of gas (litres) with the kilometers driven (mileage) between 2 dates.

View 2 Replies

Loading An Image From A Jpeg That Exists In Memory (but Not On Disk) Using Direct Memory Access

Nov 5, 2009

In VB 2005, I am calling a C++ DLL function that returns the address in memory and size in bytes of a jpeg image. How can I load that jpeg image directly from memory into a picture box in my VB form? I cannot afford to save it to disk first.

View 10 Replies

Attempted To Read Or Write Protected Memory / Often An Indication That Other Memory Is Corrupt

May 22, 2007

Im getting a problem with one of my programs I have made in visual basic.NET where it gives me a memory error when i debug the program in the IDE. the exact error is this: "Attempted to read or write protected memory. This is often an indication that other memory is corrupt". My program basically has a few forms with text fields on that get their text values from an access database on the same hard drive. Im wondering if im doing something wrong because my program just seems to eat up memory whenever it does anything. For example I have one form that has a combobox on it and when you change the drop down list selection it retreives a few strings from the database and puts them into the relevant text boxes, if you keep changing the selection then the memory usage (in task manager) just keeps going up and up. occasionally I get the error mentioned above when debugging but in my built version of the program it throws an exception everytime the memory usage gets past 49K.

Also I noticed when debugging in the "immediate window" frame I get the following message often:A first chance exception of type 'System. Invalid OperationException' occurred in System.Data.dll...Do I need to somehow be "releasing" the memory that is used to gather data once it becomes redundant?

View 12 Replies

Attempted To Read Or Write Protected Memory. This Is Often An Indication That Other Memory Is Corrupt

Nov 24, 2011

I am using the following code

This error occurs :

Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Public Class FormRegEnumValue

[CODE]......................

View 2 Replies

Attempted To Read Or Write Protected Memory. This Is Often An Indication That Other Memory Is Corrupt?

Feb 1, 2009

QuoteSystem.AccessViolationException was unhandled Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt." Source="System.Windows.Forms"

Im designing a web browser and i continue to receive this error after going to about 3 websites it crashes with that error.

View 6 Replies

Necessary To Detach Event Handlers To Ensure That Memory Is Cleaned Up And That There Are Not Memory Leaks?

Jan 20, 2010

I have a BackgroundWorker object that I instantiated to perform a DB process on a background thread ansynchronously. I have event handlers for DoWork and RunWorkerCompleted. I can tell that the BackgroundWorker is disposing of itself because I added a message box into the Disposed event handler.Is it necessary to detach the event handlers to ensure that the memory is cleaned up and that there are not memory leaks?

View 1 Replies

Thread And Memory Leaks - Memory Usage Jumps About 1000k And It Never Goes Back Down

Apr 17, 2011

I've noticed that every time I start a new thread in my program, the memory usage jumps about 1000k and it never goes back down. I have ensured that the thread is no longer running, and only one instance of my worker thread is ever running at a time. I am using ThreadPool.QueueUserWorkItem and ASyncOperation to get stuff done. The program starts using a Sub Main in a module that uses STAThread; I read that using STAThread instead of MTAThread makes it impossible for the Garbage Collector to get in and consider objects for garbage collection. However, when I change the STAThread to an MTAThread, the WebBrowser control in my frmMain cannot be instantiated.

I get this exception:

Code: An unhandled exception of type 'System.Threading.ThreadStateException' occurred in System.Windows.Forms.dll

Additional information: ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment. I do threading with the WebBrowser control, so will using MTAThread fix my problem? If so, how should I partition my code so that the WebBrowser control won't be affected by the above exception? I call the thread repeatedly with a timer (although only one instance ever runs at a time), and my program's memory usage starts at about 5000k and can jump to 300,000k+ depending on many times the thread needs to be called.

View 6 Replies

2008 Express Edition: Attempted To Read Or Write Protected Memory, This Is Often An Indication That Other Memory Is Corrupt?

May 27, 2009

I cannot use Visual Basic 2008 at all. When I go to "new project" and choose "Windows Form Application" I get this error.I have tried multiple uninstall/reinstall with no result.A microsoft reply to this suggested that I needed: " .NET Framework 2.0 Service Pack 1 " I checked, and I did not have the .netframework 2.0 service Pack 1.
When I tried to download and install the above from Microsoft.com, the istaller said that "it was not allowsed" and I was not able to install the service pack 1.

I tried Uninstalling net framework 3.5, 3.0, 2.0 and then reinstalling .netframework 2.0 sevice pack 1; then reinstalling Visual basic 2008 express edition. At the reinstall of Visual basic 2008, .netframework 2.0 sevice pack 1 is unistalled by .net framework service pack 2.When I check the foruims for simiar problems, the formus are mostly for Visual basic 5.0, or other programs that I do not have.

Here is the programs I have installed:

Operating system: Windows XP
Microsoft .net framework 1.1
Microsoft .NET framwork 1.1 Hotfix(KB928366)
Microsoft .Net Framework 2.0 Service Pack 2

[code]....

All the security updates and hotfixes for Widows XP.

View 4 Replies

DirectoryEntry Memory Leak - Gets A Out Of Memory Error In The Last Catch Statement?

Jan 11, 2012

The follow code can be called about 6K times on the server it is run on then gets a out of memory error in the last catch statement. I don't see what is wrong with the code, it works well up until the out of memory..

Public Function AddUserToGroup(ByVal sSamAccountName As String, ByVal sGroupName As String) As Boolean
Try
Dim returnStatus As Boolean = True[code]......

View 3 Replies

Read Or Write Protected Memory Often An Indication That Other Memory Is Corrupt?

Feb 9, 2011

I have two forms, Form1 and Form2. Form2 has a button to show OpenFileDialog. I call Form2 from Form1 by a button. My startUp Form is Form1. When i start debugging, i press my Form1's button to show my Form2, it shows, but when i click On Form2's Button to show OpenFileDialog it is giving me exception that

"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

When i set my startup Form to Form2 and click Form2's Button to show OpenFileDialog then it shows!

View 13 Replies

Way To Reduce My Code

Feb 15, 2010

I am creating a windows mobile application .I have an extraordinary amount of if/else statements, I have tried the switch/case statement [code]...

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved