Function For Plotting A Graph - Facing A Memory Leak?
Aug 10, 2009
I found this function for plotting a graph online somewhere. I am pretty sure it has a memory leak but cant figure most of the functions as I am new to VB and windows API. Looking for some quick tip on what I should be looking at.
I am trying to plot a set of data using a function I have defined as an array: Private Sub calculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles calculate.Click range(1) = min.Text For i = 2 To 100 [Code] ..... Range(i) I want to be my x values and fee(i) to be the y values. When I try to select range() and fee() as the x and y values for a series, I get an error because they are not of type double.
I have this relatively short function, triggered when the mouse is moved over a picturebox. When being called, it slowly increases the RAM and PF usage of the program which never recovers.[code]I just wanted to report back and say that I did solve this issue (more or less).I added a manual garbage collection call at the end of the loop and it kept the resources usage under control. It did seem to slightly slow the response time, but it's worth it to avoid the program hogging multiple GBs of RAM.
I have that code running into a windows service and the service seem to have a memory leak, something is wrong for sure. After looking at the whole code, I think it might be inside one of these function but I cannot seem to find where it could be.
I was writing a program on a web form which is reading a file and then plot the file as a 2d graph.
the file looks like
c1 number1 number2
[Code].....
where c1 c2and c3 is the header which the readfile stream should ignore and the total "number" numbers are decided by the user which can be a variable.
the graph will take the c1,c2,c3values as x-axis and the number values as y-axis.
how can I draw the graph from reading this file? can some one kind enough to show me some code?
I wanted to plot a graph for one of my application in VB.net. I want a Time (X-axis) Vs Temperature (Y-axis) graph, where:
1. X- Axis has vertical lines every 10 minutes. So there are 6 vertical lines between 1 hr. The labels on the Axis should be written at every hour even though the vertical lines are at every 10 minutes. (Eg: 10:00, 11:00, 12:00, 13:00, 14:00...)
2. Y-Axis should have horizontal lines every 10 degrees C. So there are 10 Horizontal lines between 100 degrees. The labels on the axis should be written at every 100 degrees (Eg: 0 deg C, 100, 200, 300...)
Currently, my circuit is connected to a power supply and is connected to the computer via a RS232 cable. Voltage level is extracted and the real-time voltage level is plotted (see attached image) and it will keep movingBut you will realise that there isnt any time shown on the X-axis. I would like to display time in such a way:Each long marker will represent 1 second and there are 4 long marker, which will represent up to 4 seconds.When the (5th second) voltage is sense and the real-time voltage is drawn, i would like the new time (5th second) to replace into the 1st marker postion, the (6th second) to replace the 2nd marker position, so on and so forth. The replacement will continue
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]......
This code was put together for a one time run. It's purpose is to count all the pages in a group of images. After about 6000 of 1,250,000 images in ##X it throws an "out of memory" error. Besides it being thrown together for a one time run does anybody see anything obvious that could be causing the error?
I have the following Leak situation in a VB.NET (.NET2) application: a form - DetailTache (TaskDetails) - in my MDI application is not garbage collected is not collected ofter open/close.
EDIT: Result search from projet of WinComboRowSelected Event. There are 3 usages of this word in application:
Declaration in Class WinCombo: Event WinComboRowSelected(ByVal sender... (only one) Raising: RaiseEvent WinComboRowSelected(sender, (3 raisings) Usage: ...e As Keolis.ctlWinCombo.WinCombo.WinComboRowSelectedEventArgs) Handles cmbProduit1.WinComboRowSelected (multiple handles).
I refresh a DataGridView every second. It has about 50 rows. This ends up using the entire memory of the computer in about 1 day. I wanted to see what recommendations you had to clear up this memory leak.
The DataGridView1 is bound to a DataTable. DataGridView1.DataSource = MyDT
I refresh a DataGridView every second. It has about 50 rows. This ends up using the entire memory of the computer in about 1 day. I wanted to see what recommendations you had to clear up this memory leak.
I am having a very strange memory leak that seems related to databinding. It is very hard to reproduce, so I won't post any code here to do so, but will just describe the problem.We have data entry forms which have controls which bind to custom business objects through a BindingSource object.
I am working on a desktop application in VB.net 2005. The application contains a timer with an interval of 1 min. Each time the timer ticks, a set of functions gets executed, mostly database related.Initially the application runs fine. In processes(Task manager) the cpu usage goes to 100% every time the timer is invoked. But the timespan is around 1 sec(negligible).However as the time passes and after around 20 hours the time span of timer_tick increases to something like 20-30 secs. In this period cpu usage is 100% and the application does not responds. Gradually the time span of timer_tick increases to 1 min and the cpu uses gets stuck to 100% and the application does not responds.All objects are properly disposed. Moreover, this issue is with pentium 4 processors. The application runs fine on core 2 duo.[code]Many Select, Update and delete queries are performed in the timer.This problem occurs when I am using around 7000 records in database.
I am working on a desktop application in VB.net 2005. The application contains a timer with an interval of 1 min. Each time the timer ticks, a set of functions gets executed, mostly database related.Initially the application runs fine. In processes(Task manager) the cpu usage goes to 100% every time the timer is invoked. But the timespan is around 1 sec(negligible).
However as the time passes and after around 20 hours the time span of timer_tick increases to something like 20-30 secs. In this period cpu usage is 100% and the application does not responds. Gradually the time span of timer_tick increases to 1 min and the cpu uses gets stuck to 100% and the application does not responds.All objects are properly disposed.Moreover, this issue is with pentium 4 processors. The application runs fine on core 2 duo.
This is a very simple UDP Listener class. I can add it to my applications and give them the ability to accept a text command from a UDP packet. I use it for simple, insecure, non-vital communication between a couple apps. The code as written here works--except it has a memory leak. The program's memory usage will slowly build until it crashes. I believe I'm doing something wrong with the way I do the udp.receive method or perhaps the threading? I was trying to keep it as simple as possible when I wrote this, but let me know if I'm doing anything wonky here.
I created a simple application to display the current Date/time on a Form (see below). When the application runs, the amount of memory used continues to grow. I don't see any obvious problems. I am running Visual Studio 2008 on Vista Business OS.
This is a little app that sits in your task bar and check a website for the presence of a simple string. The string is either "ONLINE" or "OFFLINE". THe problem is that there seems to be a minor memory leak, since every once in a while (I suppose when the timer expires) the memory it takes up increases by a good bit. [code]
[Code] There is a dispose part that is called just after it finishes processing (don't know if it works, but from what I read I should be disposing it? [Code] When I run it like the above, I have NO memory leaks. It works great. I can have it run for hours and generate everything I need without any issues at all. When I change it so the oThread(ThreadCntr).Start() is working and I comment out MQM1(ThreadCntr).RouteIt() it fails around the 400th thread call (keep in mind I only do 10 threads at a time) from using up too much memory. If I run it with oThread(ThreadCntr).RouteIt() commented and using MQM1(ThreadCntr).RouteIt is working, it will run forever without running out of memory.
I am having a problem with an application I have developed, there seems to be a memory leak that causes the application to crash when it fills up the RAM. I have a process that repeats for each row of a given table, while this process works fine there is one line in particular which converts the results of a linq .tolist which is never disposed of. Since this process is only able to be executed ~200 times before an outofmemory exception occurs.
How can I dispose of the instance of each class to clear this memory in between iterations, or failing this is there a particular area in which I can look further to solve this problem?
I am having a problem with a Windows Service I have written, if I enable a certain option I am seeing what I think is a memory leak. I've looked at trying to debug this using crash dumps (the app doesn't crash BTW, I create them using process explorer), .NET Memory Profiler and WinDbg but I am not getting far down to my lack of expertise with these products.
The piece of code causing the problem is below, if I comment the call to this code out, memory usage is fine. What I am seeing is the private bytes for the process going up and up and up. This code is called regulairly and after 24 hours the private bytes for the process are huge (say 2GB) wheras if I comment the call to this code out the private bytes remain at around 160MB, fluctuating up and down as expected.I am not entirely sure if I am disposing of everything correctly (I think I am) and I just cant find whats causing the problem.
Here is the code:
'//CREATE REFRESHER FOR OUR CPU USAGE Dim intProcessIDPre, intProcessorUsage As Integer Dim strProcessName, strUserName As String Dim intPrivateBytes As Double
I'm using a WinForms App built with IdeaBlade and DevExpress ... It looks to me like the DevExpress controls are causing objects to persist in memory. I'm trying to find what is preventing the garbage collector from removing then with little success.
Can anyone recommend an analysis app that is good at finding what handler, etc is holding an item in memory?
I've used AQTime 7 Pro and .Net Memory Profiler, but neither of them seem to make it clear what is causing the issue.
I'm trying to get to grips with how Windows Forms applications manage memory allocation. I'll give you an illustration of the problem. Take this simple winforms app which is a main form with two buttons: one that opens a form containing some random data, and another button that closes all open forms (except the main form) [Code] You can see the memory dropping at intervals (I've marked some of them above) which is good but it still slowly has a minimum that creeps up and up.
This is a very basic illustration of a much bigger production issue with a huge application with 100,000s lines of code and users that keep the app open all day. Over time they open and close a lot of forms and the memory creeps up. Is there any way to force the allocation down? I know I can force GC but this won't do anything as it's the memory post-GC that is remaining high as far as I can see.
This isn't a problem with references as far as I can see because I have spent some time experimenting with just one form in the main application opening and closing it and there are no references after it is closed and disposed and yet the memory still creeps up in a similar way to that logged above. Also if it was a problem with references, I'm not sure how that would explain my test app above.
I'm having an issue which looks like a memory leak in one of my applications (the application uses more memory over time, an after about a week of work it hangs). I've detected and fixed some leaks related to classes I've written (comparing heap dumps taken with sos.dll revealed them quickly), and those no longer increase in number.
Currently, the only thing that dramatically increases over time are WeakReference instances, which increase at a steady rate of 1,000 new WeakReference instances per minute.My code doesn't use WeakReference directly, I never create those myself.
What could cause so many WeakReference instances to be created? I'm using VB.NET, Visual Studio 2008 and .NET 3.5
I have done a lot of research on the memory leaks present in the WebBrowser control, and the following thread (http:url]...) told me that the only real way to reclaim the memory eaten up by WebBrowser is to load the control in a separate appdomain.I went ahead and did this, but when I unload the AppDomain that the WebbBrowser is created in (using AppDomain.Unload()), the memory is still not freed. I am looking at the Private Bytes of the process in Task Manager (which is accurate and what I'm interested in) to confirm this. The memory usage stays at 50MB+ instead of its default 5MB.Here is my code:
Form1.vb Imports System.Reflection Public Class Form1 Private ad_WBInst As AppDomain[code].....
I am supporting an application, which uses lots of String concatenations and I believe this is the cause of a memory leak which eventually causes an OutOfMemory exception. Please have a look at the code below:
Public Sub ConcatenateString() As String Dim Test1 As String Test1 = "Hello" Test1=Test1 & "my" Test1=Test1 & "name"
[code]....
I believe there are nine Strings in memory at line ten as String is an immutable object, but only one reference to the String Test1 that contains: "Hello my name is Joe Blogs what is yours?". My question is; are all of these Strings picked up by the garbage collector when they go out of scope? i.e. when the sub routine finishes running. I seem to have a memory leak and am thinking that I should really be using a StringBuilder object.
I've ported an old piece of unmanaged code that used Crypto API to 100% managed .NET code. The code used DES algorithm, and had to maintain it for several reasons. Since the CryptoAPITransform instances got from the CreateDecryptor and CreateEncryptor methods are marked as reusable, I thought of just creating an instance of them and use them whenever needed.
Inspired from this question, was wondering what are the possible ways to create a memory leak in .Net. I once found one with ODBC Data Access. Has anyone had any experiences with latest version?
screenshot application I am developing that has a memory leak somewhere. The main code is as follows:
Public Class Form1 Dim strPath As String = "C:windows empscreenshot.jpg" Private Sub Main()
[code].....
The application runs from the system tray and a clickevent handler for the notifyicon control calls the Main() sub. The code calls OutlookEmail() which creates a new outlook mail object. The problem is that each time the notifyicon in the system tray is clicked the memory in use jumps up incrementally - about 3mb each time.