I found this code and wanted to know when, where and why I would use it?
vb Declare Function SetProcessWorkingSetSize Lib "kernel32.dll" (ByVal process As IntPtr, ByVal minimumWorkingSetSize As Integer, ByVal maximumWorkingSetSize As Integer) As Integer
i have a very regular problem with MS Access showing random results when being written to from Visual Studio 2008. It happens on all computers including the development machine, using Vista or XP, VS 2005 or VS 2008.Is there a VB.Net flush command I can use before reading the data ?.I write data to a table and then immediately go to read that data.I can make it work if I wait up to 3 seconds before I read the data after a write, using a sleep command. Unfortunately 3 seconds is way too long.Are there any known problems with writing data to MSAccess 2003 from .Net, using VS 2008, VB.Another weird thing that happens is that only half the data is there if I write to an Access table and then go to read it immediately. Sometimes the data's there, sometimes not, with the exact same code and data.
Sometimes the whole table fills with the data from the first record.This is happening throughout my code. Anywhere there's data being written to Access there's a problem if I go to read it immediately after.Sometimes the Access table is blank, even though data has been written to it, and then on a second run of the exact same code it comes good, or gets half the data or every record is a duplicate of the first record. The code is good, so it's not a coding problem, and I can run the exact same code and get good results. So it's definitely an intermittent problem.I run all my access writes through the same code. The part of the code that writes the data is "command1.ExecuteNonQuery()". Whether I read the data from a datatable or as a merged word document, I still get the same problems. So I'm guessing that there's a problem
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.
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.
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?
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.
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.
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?
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.
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]......
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!
When I importing multiple files from open files dialog ..sometime in random cycle jumping exception out of memory.Take look in the code..and say why this exception exist ?
I have a Flash Calculator made for specific calculations. I can't extract values automatically, because it doesn't allow copy and paste. However, I know handler and address for those values, how can I get them in to my program?
how to read memory with VB. I want to start with Basic Mind Sweeper game. In mind sweeper if you set default greed/field (9 by 9) you can find all mines location of in memory from Address 01005360 to 01005468. Hex dumb 8F represents a mine. write a program in VB.Net 2008 that will display Hex Dumb of address 01005360 and 01005368 for mind Sweepers . So Basicly I need put all hex dumbs in string from hex dumb "10" in adress 01005360 to the next hex dumb "10"
I have an application (i've been working on for a long time) that has many tabs and controls and quite a few components And a good deal of design code. And a list box that has around 100k items (i had to put a loader to pass the 3-4 seconds while its loading to prevent it from not-responding)I had a few Gc.collect calls in specific places (mostly after many items are added or removed). When my application loads, i call GC.collect only once at the end of the load. The program consumes around 35K memory by the time its loaded. However, i decided to mess around abit (don't worry i made backups)First i started putting gc.collect in some random places, and to my surprise the memory upon loading was observably decreasing. Then I went ahead and put a macro that puts GC.Collect before every End Sub, Exit Function, Exit Sub, and Return value, there is. Basically every block in my application had atleat one GC.Collect. I fixed some 6 or 7 silly replace errors and compiled. When the program launched, the memory used at the end of launch was 21K!
At first glance that seemed great, but then i realized switching between tabs was VERY glitchy. and adding new lists took around 10x more time than usual (the loader stayed on for around 20 seconds!) And even though the memory looked good, the program was useless like this.Then i decided to mess around differently. I removed GC.Collect from the entire solution. It was no longer called even once.At first glance, when i launched the app it consumed just under 60K memory. That seemed terrible. However i realized something: even though my program in that state showed on taskmanager that it was consuming alot more memory than usual, it seemed like it was lighter than ever! Switching tabs was faster than before, especially every time i go to the tab that has the listbox control with 100k items. Loading items took around 3-4 seconds, but there was no stutter when the list finished loading whereas before it had an evident 0.3s stutter after the items were added.
This was all surprising to me because i thought GC.Collect was first of all, something that it doesnt matter where or how many times you call it. I thought it was just something that should be called at the end of work and i didnt think it would matter if it was called during work.Second of all, i thought GC.Collect only affected resources that are inaccessible, or resources my program is done with. How come the application feels faster when i don't call it?Third of all, i thought the VB CLR does most of the memory cleaning for me, and that GC.Collect was somewhat of a redundant command. It didn't seem so redundant to me at all considering the difference between using it heavily and not using it at all was around 38K in memory usage!
So i guess my questions are: 1) Do I need to call GC.Collect? WhereWhen do i call it?2) Why does calling it affect performance? And where does one draw the line between that memory stat on taskmanager and the program's performance?3) I also decided to run a small test. Why does a blank vb form application require 10K memory? How accurate is that stat shown on the task manager?
I'm writing a application that has to check live what's going on somewhere. The data is stored in a integer array.But this data comes from a PLC over a COM port. So imagine if someone pulled out the cable while my application is running. I have to find a way that the integer array will be stored somewhere when my application crashes. I thought maybe I could do something with a text file? But how do I get my application to store the data when it crashes? Do I have to surround my whole code with a try catch and then in the catch save everything to a text file? Well I like to know if some of you have better ideas or can point me in the right direction.
im trying to format my results from some WMI quires but im not having much luck.
i want to display my available memory as Mb's not Bytes. in the past ve done the following
vb result = (queryObj("TotalPhysicalMemory")) / 1024
usually that works but its giving me a retarded result, its giving me 3581.98828125 as the result, but i do the same way with my video card memory and it displays it as 512 like it should. ive tried every way i know of formatting and decimals but non of it is working.
im dsplaying my result in a text box and ive also tried formatting it thier with no such luck
Im currently working on a chat room application and im wondering if its possible to transfer a file and keep it in memory untill all of file is done sending, then saving that file to the computer.
I'm trying to work out a bit of a memory leak and was hoping someone can assist. The below program is running fine except for one thing. 1. The memory leak. When I run the program and watch task manager, I can see the memory usage of the program starts at roughly 14 meg. Over a period of hours, that increases pretty substantially. Eg. at 6am this morning, it was at 14 meg, and by 3pm it was at 36 meg.In a nutshell this program takes an incoming stream of data which looks like this.
It basically parses the stream and places items into hash tables depending on the type of data. Eg. I have a hash table for latitude, one for longitude, one for altitude, etc.The key is always the hex code eg. in the first line above the key would be 461D3B.Essentially, as the data arrives in and is parsed and placed into hash tables depending on the type of data, I also have another hash table dedicated to keeping track of timeout times for that individual piece of data. The timer event fires and if the timeout is exceeded for that piece of data then it gets removed from all the hash tables.
I believe this is working. I've done heaps of debug output to the output window ensuring that items are being added to and removed from the hash tables successfully. Eg. ensuring that the hash table record count matches what I believe the number of active records should be.I'm at a loss what could be causing this memory leak though. I'm assuming i'm not disposing of an object properly, or not initializing/declaring it properly, but I can't work out what i'm doing wrong.One thing i'll mention though. The timer event occasionally comes up with a warning about the contents having changed during the For..Next loop. I don't think this will affect things though. As long as the hash table item count matches what it should be, I don't see that being an issue.
Imports nsoftware.IPWorks Imports System.Data.SQLite Public Class frmMain
I have many forms in my project. When the project starts to run, the form named as˜frmMawill be loaded. I had given links to load other forms from this form. When other form gets loaded I want to close this main form. To do so I used the following
Alright, for a school project i'm making a filecrypter, and i need to load the executable directly into the memory.
For those that don't know it yet, a crypter consists of a crypter, and a seperate "stub"
the crypter crypts the file, and the stub is binded to the file, and upon execution, the stub is executed, and in turn executes the file it's bound to.
I have a RunPE sub, and on itself it works fine
Imports System.Runtime.CompilerServices Imports System.Reflection Public Class Form1
I noticed my program starts out at between 20-25 MB of RAM usage upon launch.It levels out at around 28MB once the two forms that are used are open.Sometimes it will hit 31MB. But that's usually max.It simply consists of an initial form on loadup for the Notification area Icon and then two forms that are loaded when you right or left click on the icon.One they are loaded they are either hidden or shown when you click on the icon.All-in-all, the program isn't doing much; no large calculations, no huge amounts of data being manipulated, etc.
I have an application that requires the use of many threads. How do i monitor the memory consumption of my application?And how can i monitor the CPU usage of my application if possible?And is it possible to monitor the memory consumtion and CPU usage of each of these threads?And is it possible to limit or prioritize the memory consuption or cpu usage of the whole application or of each thread?
im trying to read "calculator" from calc.exe, now i found the mem adress where the value resides but i have a few problems
1) how many bytes should i read? im not just talking about calculator string but potentially any length string, i get different results with 4/8 bytes but same from 8 - 32 bytes
2) when i read i get a long value 27866486557179971 but how to convert that into a string
EDIT: ok by staring at the return value long enough i discovered that when i convert it to hex it spells "calc" backwards, same for all other strings, i could build a working converter based on that knowledge but now what bugs me is where is "ulator" or the rest of the string, the most i can get is always 4 letters
EDIT2: oh nm that, by moving memory adress a step further i get the next letter along with 3 previous ones and still backwards but i can work with that
ok so now next step would be making a search function for which i need to find out the range of memory to scan, anybody know how to do that?