|
After doing a little research on GC collect I have come to the same conclusion as the one you posted, hence the idea of using it doesnt really sit very comfortably with me.
Unfortunatly I have to compress and chunk, as the bigger bigger picture is that the send is done via a 3rd party intermediary that has defined this model. Unfortunately I do not control this and therefore I need to work with it
|
|
|
|
|
Can the compressing be done without loading it all into memory? For example, the System.IO.Compression APIs let you do this by writing to a stream, which is compressed on its own. The stream should point to a file on disk, thus you never have to load the big file into memory, instead the hard disk holds it all. As for sending the chunks, again, just read pieces of the compressed file using the standard System.IO.FileStream APIs.
|
|
|
|
|
Unfortunately I am stuck with .NET 1.1 so the compression libraries arent available for this
|
|
|
|
|
MrEyes wrote: After doing a little research on GC collect I have come to the same conclusion as the one you posted, hence the idea of using it doesnt really sit very comfortably with me.
As Luc pointed out, you really should not be calling GC.Collect yourself. The issue here is that every time the GC starts a collection cycle, it actually freezes the main thread of your application so it can determine which objects are still being referenced. By calling GC.Collect yourself and forcing a collection cycle, you are increasing the amount of time your application will spend in garbage collection, thereby ultimately decreasing your performance.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
Since strings are immutable in C#, every time you make a change to one you are creating a new string object. It doesn't look like you are doing much actual string manipulation beyond converting it to a byte array, but if you are you may want to look at StringBuilder[^].
I don't think using a separate AppDomain is really going to buy you much as you will then incurr the overhead of loading and unloading the AppDomain.
Finally, how are you determing your memory usage? The information shown by task manager is not accurate for .NET applications and should not be used. You should be looking at the .NET related performance counters in perfmon.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
Well I have to admit I have been monitoring memory usage via task manager so I will have a look at perfmon.
That being said, on large files (>200mb) the application eventually throws an out of memory exeception, which regardless of the monitoring mechanism is, how can a put it, catastrophic
|
|
|
|
|
Good People,
I have a data grid and I am trying to get a value from a cell. When I try to dereference the cell (i.e. DataGrid1[3,4]) it simply returns the coordinates (i.e. something similar to "Column 3, Row 4"). Any ideas or help you can provide would be great.
Thanks,
BP
|
|
|
|
|
u can access cell value by writing sth. like following
datagrid1.rows[i].itemarray(i).text
where itemarray represents the columns
|
|
|
|
|
I created an array list and added items to it.
When i search for items, i use the Enumerator.
When i find some items, i actually want to either remove or update the values. How would i do that if i am in an Enumerator loop
like
myEnumerator.Reset();
while (myEnumerator.MoveNext())
{
//found the item
//need to update the item, or remove
}
|
|
|
|
|
You will not be allowed to delete an item in an enumarator. You will have to loop through an instance of the arraylist and delete the item in the list
foreach (string s in new ArrayList(alData))<br />
{<br />
if (s == strSearchData)<br />
alData.Remove(s);<br />
}
|
|
|
|
|
Thanks,
how would i replace an element in the list... i do not see a function to replace in the array list.
|
|
|
|
|
foreach (string s in new ArrayList(alData))
{
if (s == strSearchData)
alData.Remove(s);
if (s == strFindData)
alData[alData.IndexOf(s)] = strReplaceData;
}
|
|
|
|
|
One thing you should watch out for is that changing the size of the list during a foreach() call will throw an exception.
So make sure that you don't add or remove items during enumeration. Find the items you want to operate on, save references to them (or their indices) and call the appropriate methods after the loop finishes.
|
|
|
|
|
I placed a gif file in my form,But its not animating
how can i do this?
My small attempt...
|
|
|
|
|
|
I have a gif file, can i place that in grid? i want to see the animation also
i tried with picturebox but no effect
My small attempt...
|
|
|
|
|
Greets all
Can anyone tell me how to apply the SeDenyInteractiveLogonRight right to an account in C#, preferably using the DirectoryEntry class?
Thanks
ccitt
|
|
|
|
|
Hello. I'm having a problem with Remoting.
I have remotable object that has a list of messages (arraylist with strings). That class is in a DLL file.
I have an application that uses that class. In some parts of the code, I add messages to the list.
Finally, I have another application where I want to show the messages. I receive the message using remoting, but the object comes without any message. The list is empty.
What can be happening?
Regards,
Diego F.
|
|
|
|
|
Hi,
I want my application to process multiple files, which it shall receive via the Windows-Explorer context menu entry "Open with...". I checked the command-line arguments, but the string[] has always just a length of 1 and string[0] only contains the first of all selected filenames.
How can I get all filenames which were selected when "Open with..." was clicked?
Thanks in advance,
Alex
|
|
|
|
|
To go more into detail: Am I right that I have to look for the selected filenames in the command line parameters?
Hasn´t anybody an idea? I don´t think that I am the only one who wants to receive multiple files using command line parameters...
|
|
|
|
|
Hi,
FYI: I have an "Open with myprog" added to the Explorer's context menu
(installed by adding some registry entries).
When I select two files in Explorer and apply "Open with myprog", Explorer
calls my program twice, once for each file (rather than once with a list of files).
|
|
|
|
|
Hm, thanks for this info, I already assumed that. I blocked opening multiple instances of my program the following way:
public static void Main(string[] args)
{
Process[] processes = Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName);
if (processes.GetLength(0) > 1)
{
IntPtr hwnd;
if (processes[0].MainWindowHandle == Process.GetCurrentProcess().MainWindowHandle)
hwnd = processes[1].MainWindowHandle;
else
hwnd = processes[0].MainWindowHandle;
if (IsIconic(hwnd) == true)
ShowWindow(hwnd, 9);
else
SetForegroundWindow(hwnd);
}
else
{
Application.Run(new myApp(args));
}
}
Do you know a way to send the new args to the previous instance from which I have the handle? Or is there another common method to solve this problem?
|
|
|
|
|
Hi,
my app is singleton too. It is based on a mutex, not process names.
a second (third) instance sends its command line to the original instance,
using named pipes (and several P/Invoke calls).
(actually I believe the singleton behavior could now be based on the result of
CreateNamedPipe rather than a separate mutex).
BTW an earlier version used sockets to send the cmd line, but that kept
triggering my FireWall (McAfee).
|
|
|
|
|
In my project I have been working on a class that will extract files from a zip, then import all data in those files using SQLBulkCopy into the database. While importing the data I need to know the Information about that particular file(Name, Count\Index). So to do this I need to use events. I have been working at this, got my properties, delegate and event written. All seems to be good, then I try to use the event and I ran into some snags. It turns out that I don't have anything assigned to handle OnImportFile. Below is my delegate and event in my class.
public delegate void GNISImportFileEventHandler(object sender, ImportFileEventArgs e);
public event GNISImportFileEventHandler OnImportFile;
So to assign something on handle OnImportFile I have this:
OnImportFile += new GNISImportFileEventHandler(OnImportFile);
From the articles I have been reading this is the correct way to set something to handle my event, but I get the exception "Delegate to an instance method cannot have null 'this'." Any suggestions or an article that covers this issue would be greatly appreciated. Cheers
|
|
|
|
|
I think any msdn article on event handlers should help you out. But from the code it looks like you are trying to assign the event itself as the handler. Normally you would write a method which has the same signture as your delegate. That method will be your event handler. Something like
public delegate void GNISImportFileEventHandler(object sender, ImportFileEventArgs e);<br />
public event GNISImportFileEventHandler OnImportFile;<br />
<br />
public void myGNISImportFileEventHandler(object sender, ImportFileEventArgs e)<br />
{<br />
}
And you would add the handler like:
myObj.OnImportFile += new GNISImportFileEventHandler(myGNISImportFileEventHandler);
modified: added "myObj." Assuming myObj is the object of your ImportFile class. It could be this. if you are adding it to the same object (which is really not needed since you can just call the method directly..
|
|
|
|