|
Hi,
I am writing a networking application in C#.
The application transfer data of a few MegaBytes.
Initially, the application takes up about 10MB,
then after the network data transfer for about 6MB,
the memory usage (info from the taskManager) is about
100-200MB !!! So what is the reason for the application take
up so many memory ? And how can I solve the problem. It seems
that .Net application is a big memory eater !
Thanks
|
|
|
|
|
There can be all sorts of reasons for memory usage. The main one is, if you create a variable that impliments IDisposable, you should use a using block to ensure the memory is cleaned up right away.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Try to use a reasonable buffer when transfering data from your file to the network. It's simpler to just read the whole file into a single array and then write it out, even though that is probably the worst for memory use. Just because memory is managed, doesn't mean it takes up less space.
Also, in windows memory is assigned different uses. Most of the memory you are seeing will probably be released if other applications need the memory. You can usually see this effect if you minimize a .net forms application.
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
|
|
|
|
|
If you create many large objects, they will stay in memory until they are garbage collected even though you have dropped the reference to them.
These might apply:
If you are using a buffer, try to reuse it instead of creating a new buffer for each data block.
If you are concatenating strings, use a stringbuilder instead of the += operator of the string class. Strings are immutable, so eventhough the += operator gives the impression that the string is just appended with the new data, a completely new string is created and the data from the two strings are copied into it.
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
I am writing an client-server application with networking in c#.
For the client part, I am using a synchronous network connection, that is,
when the client request the server, all the client features will be
hanged until the server response. So is it a common strategy in
implement client ? I am considering using threading or asynchronous
network connection, but it seem too complex and hard to maintain
the user logic. So any other good methodology to handle the problem ?
Thanks
|
|
|
|
|
For example,I draw a line on the surface of graphics with GraphicsPath.
Sometime I want to clear the line,how should I do?
|
|
|
|
|
If you want to clear the entire entire canvas, just call your Graphics object's .Clear() method.
If you want to clear just the line itself, you'll have to create a new pen the same color as the canvas background, then use it to redraw the line exactly the same way it was drawn originally. If your line intersects with other lines or graphics objects, it'll draw a background colored loine through them.
The only other way to do this would be to redraw everything onto the canvas that was originally drawn, but don't draw the line that you want to erase.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have a web application that needs to modify some files in the web folder. I have notice that after installation, the ASP.Net account doesn't have modidy permission and have to grant it manually. Is there a way for me to grant the ASP.Net account modify permission during installation throught programming or setting so properties? Thanks.
|
|
|
|
|
It's not a good idea to modify the permissions on the site's parent folder. A better idea would be to create a subfolder off the site root and put your modifiable files in there.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have set the launch condition in my installer to check for the .Net Framework. Is there a way for me to run the dotnetfx.exe if the condition fails. I want to run it automatically or programmatically from the installer. I can launch an executable programmatically, but where do I place the code for it? I perfer to do it automatically though.Thanks.
|
|
|
|
|
I believe you can get a merge module from Microsoft, which means your installer will install the .NET framework for you. Personally, I write a little exe to run my MSI and anything else I want to run.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Where on the MS website can I find the merge module? I have typed in different combination of the words merge module, .net framework, and dotnetfx.exe, but can't find anything relevant. After I have the merge module, do I just added it to my installer project? Thanks.
|
|
|
|
|
This[^] is probably your best source of info
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks for the help Christian, I got it to work.
|
|
|
|
|
i've a list view with large icon view.
i've to select multy objects and make a drop into another one.
How?
|
|
|
|
|
Hi Everyone,
I am making an application for language specification and using satallite assembly.
If we use satallite assembly means there is no need to recompilation of application.
What I am doing that is given below step by step.
1. Created file like string.txt,string.de-DE.txt,string.ja.txt
2. compile all txt file with "resgen.exe" at command prompt like "resgen string.de-DE.txt string.de-DE.resources.
3. Again compile all resources file with "al.exe" like "al /t:lib /embed:strings.de-DE.resources /culture:de /out:myApp.resources.dll"
4. Created folder in my application for different language specification like "de-DE","ja"(Folder name)
5. Put file in this folder like for "de-DE" folder for myApp.resources.dll,string.de-DE.resources,string.de-DE.txt
6. In coding part "myapp.cs"
a) //static ResourceManager rm = new ResourceManager("myapp.string", Assembly.GetExecutingAssembly());//myapp is "namespace"
static ResourceManager rm = new ResourceManager("myapp.string",(typeof(Class1).Assembly));//string is "base name"
b) cultureinfo and switch case
7. Question is that if i don't make these resource file as satallite assembly then it works fine but if i make these resource file as
satallite assembly and put the resource file and dll in folder then it doesn't work.
8. If i run this application it pick up default one english language specification but not pick up german or any other language.
9. I am following each step that is given in MSDN.
Thanks
|
|
|
|
|
I am new to C# and am trying to find a way to change the text displayed in a given ColumnHeader in a DataGrid. I would like to display text that is "human understandable" rather than some of the cryptic field names some folks have put in the Database. That I can determine the Columns Collection doesn't have a property that allows this. I am probably just missing it somewhere. If anyon can point me in the right direction, I would appreciate it.
Thanks
Ken Jinks
|
|
|
|
|
|
I am not an expert by any mean but the method worked best for me and was fairly easy was to use alias in the select statement, something like this:
SELECT UID as [User ID], UNAME as [User Name], UADD as [User Address]
FROM tblUserInfo
Hope it will help.
|
|
|
|
|
jinksk wrote:
I would like to display text that is "human understandable" rather than some of the cryptic field names some folks have put in the Database.
u could put column styles for the columns
then give the header name as anything u want.
|
|
|
|
|
I have a dataGrid in my windows app which i have a colum name amount and a column named Total.
I need to show Total after every transaction. Can someone tell me how can I do that at run time?
ID | Date--| Description | Transaction Amount | Total<br />
01--1/1/01-----xyz--------------10---------------10<br />
02--1/2/01-----xyz------------(-05)--------------05<br />
03--1/3/01-----xyz--------------25 --------------30
Very similar to a check book register. Hope that helped.
Best Regards,
Rob
|
|
|
|
|
Is this a web or windows app ? If web, then handle the itemdatabound event, and store a running total. Otherwise, I'm not sure if winforms has this event, if not, you could always add it to your data table before binding.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
This is a windows app. Can you help me with that I am not much knowldgeable when it comes to working with windows datagrid. Sure would appreciate it . Thanks.
|
|
|
|
|
The windows grid doesn't have such an event. I think you need to add a column to your grid, then use foreach to step through each row, and insert your running total. Then the grid will display the total like any other column.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks a lot for your reply. Could you please post as to what the for each statement would look like? like I said I am really illiterate when it comes to working with datagrids
Once again I do appreciate your replies.
Best Regards,
Rob
|
|
|
|