If a compiled exe project is under 400kb, why does it take up 15Mb when
running? Is this normal?
If not, how do I restrict the amount of memory it can consume?
Secondly, does anyone have a bit of code that will traverse a directory
structure and return the name of the oldest file?
Thanks in advance....
Dave. 8 1274
It really depends on what the program does. .NET handles memory differently
from previous Microsoft systems, ie COM. It is quite normal for an
executable to consume large quantities of memory, as the .NET system eats
memory until it needs to clean up, while COM has you explicitly destroy
objects. I would not panic on this one.
Do not have the oldest file code. Apologies.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
*************** *************** *************** ***
Think Outside the Box!
*************** *************** *************** ***
<lu****@night.c om> wrote in message
news:7s******** *****@newsfe5-gui.ntli.net... If a compiled exe project is under 400kb, why does it take up 15Mb when running? Is this normal?
If not, how do I restrict the amount of memory it can consume?
Secondly, does anyone have a bit of code that will traverse a directory structure and return the name of the oldest file?
Thanks in advance....
Dave.
basically, all it does is sit in the background, and every month or
predefined time, zips up and archives the previous months IIS log files.
as i said - 380kb (ish) as an exe, but using 15Mb+ when running! Everything
is disposed when needed, closed etc, garbage collected etc, etc. Can't think
what else I need!
<lu****@night.c om> wrote: basically, all it does is sit in the background, and every month or predefined time, zips up and archives the previous months IIS log files.
as i said - 380kb (ish) as an exe, but using 15Mb+ when running!
What makes you think the size of an executable has anything significant
to do with the size a program should take in memory? You can write very
small programs which deal with large amounts of data, and other
programs may be smaller than their executable size (if they don't use
all the classes and methods within the executable).
Everything is disposed when needed, closed etc, garbage collected etc, etc. Can't think what else I need!
You don't need anything. Just don't worry about it.
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
I have this class which will list the output of a dos command to a string array:
public class ProcessDataRetr iever
{
public static string[] GetData(string cmd, string args)
{
using(Process p = new Process())
{
ProcessStartInf o psi = new ProcessStartInf o(cmd, args);
psi.UseShellExe cute = false;
psi.RedirectSta ndardOutput = true;
psi.WindowStyle = ProcessWindowSt yle.Hidden;
psi.CreateNoWin dow = true;
p.StartInfo = psi;
p.Start();
ArrayList a = new ArrayList(); string s;
while((s = p.StandardOutpu t.ReadLine()) != null) a.Add(s);
p.Close();
return (string[])a.ToArray(type of(string));
}
}
}
If you do the dos command "cmd.exe /c dir *.* /O:d" then it will list the files in date order. The oldest file will therefore be the first one in the array.
"lu****@night.c om" wrote: If a compiled exe project is under 400kb, why does it take up 15Mb when running? Is this normal?
If not, how do I restrict the amount of memory it can consume?
Secondly, does anyone have a bit of code that will traverse a directory structure and return the name of the oldest file?
Thanks in advance....
Dave.
15 MB isn't really that big.
Look in task manager and you'll see at least a few processes taking up more than that.
"lu****@night.c om" wrote: basically, all it does is sit in the background, and every month or predefined time, zips up and archives the previous months IIS log files.
as i said - 380kb (ish) as an exe, but using 15Mb+ when running! Everything is disposed when needed, closed etc, garbage collected etc, etc. Can't think what else I need!
Thanks, but I've managed to do it with a DataTable and View
Thanks, but I've managed to do it with a DataTable and View
This can be done, in fewer lines of code, with less memory usage, and
quicker, using .NET calls...
Why would anyone EVER shell out a process to find a file?
--- Nick
DirectoryInfo di = new
DirectoryInfo(@ "c:\my\director y\name\goes\her e");
FileSystemInfo[] allfiles= di.GetFileSyste mInfos();
FileSystemInfo oldestfile = null;
foreach (FileSystemInfo fiNext in allfiles)
{
if ((fiNext.Attrib utes & FileAttributes. Directory) == 0)
// exclude directories
{
if (oldestfile == null)
oldestfile = fiNext;
else
if (fiNext.GetLast WriteTimeUtc <
oldestfile.GetL astWriteTimeUtc )
oldestfile = fiNext;
}
}
return fiNext.FullName ;
"Beeeeeeeeeeeev es" <Be************ **@discussions. microsoft.com> wrote in
message news:1C******** *************** ***********@mic rosoft.com... I have this class which will list the output of a dos command to a string
array: public class ProcessDataRetr iever { public static string[] GetData(string cmd, string args) { using(Process p = new Process()) { ProcessStartInf o psi = new ProcessStartInf o(cmd, args); psi.UseShellExe cute = false; psi.RedirectSta ndardOutput = true; psi.WindowStyle = ProcessWindowSt yle.Hidden; psi.CreateNoWin dow = true; p.StartInfo = psi; p.Start(); ArrayList a = new ArrayList(); string s; while((s = p.StandardOutpu t.ReadLine()) != null) a.Add(s); p.Close(); return (string[])a.ToArray(type of(string)); } } }
If you do the dos command "cmd.exe /c dir *.* /O:d" then it will list the
files in date order. The oldest file will therefore be the first one in the
array.
"lu****@night.c om" wrote:
If a compiled exe project is under 400kb, why does it take up 15Mb when running? Is this normal?
If not, how do I restrict the amount of memory it can consume?
Secondly, does anyone have a bit of code that will traverse a directory structure and return the name of the oldest file?
Thanks in advance....
Dave. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: lawrence |
last post by:
I'm not sure how this is normally done, on a large site, perhaps one
running Phorum. Occassionally a thread will have hundreds of entries,
perhaps a meg or two worth of data. You won't necessarily print all
that to the screen, but PHP has to hold it in memory. Run some
operations on it, or, more likely, have an array that you keep adding
things to, and very soon you run into the 8 meg limit that is the
default limit for PHP scripts.
...
|
by: Bhargavan |
last post by:
Hi group,
I have created a User control and whenever I use that usercontrol in a form,
there is a memory leak. When I open and close the form, the form along with
my user control is not disposed. It does execute the dispose methods in my
form and in my usercontrol. I am sure there is something wrong with my
Usercontrol but I am not sure where exactly the problem is. Any suggestions
will be greatly appreciated.
Thanks,
Bhargavan
|
by: Bhargavan |
last post by:
Hey Group,
I just found that the memory usuage for my .NET windows application drops
significantly whenever I minimize my application. Also I noticed when I
maximize the application again, the memory usuage increases but it is stilll
a lot less than what it was intially (when the program initially loaded). I
would like to know the reason behind this behavior. Also I would like to
know whether it would be possible to mimic this behavior...
|
by: Cy Huckaba |
last post by:
We are running our company website on a win2k server running .NET framework 1.0
and IIS 5. The pages consist of mostly static content built from a combination
of custom controls (dll is only 148k total), user controls and straight html
content. I am very strict about only using server-side controls when absolutely
necessary.
I have output caching turned on every page and user control; we do not hit any
databases; a couple of pages use...
|
by: llp |
last post by:
We have a server which has about 90% memory usuage and it seems the cache is constantly being invalidated even though there is
physical memory to use.
On development machines it works fine but on the server we see that the cache is invalidated constantly which puts higher load on
the database and generally decreases server performance.
Adding more memory is not an option right now, we just upgraded a few months ago and it was a very...
| |
by: Michael.Suarez |
last post by:
So we develop and maintain several applications used by several people
in the same company, on the same intranet.
There are several applications written in VB6, but going forward all of
the new development will be done in .NET 2.0, including eventual
rewrites of all the VB6 apps.
The VB6 executables are all stored in a network folder, and everyone
accesses these exe's using shortcuts to them on their desktop. Going
forward, we will...
|
by: garyusenet |
last post by:
Some time ago I enquired about how I interface with a program written
in an old version of C++
Any terms i use like list that follow are used in their common everyday
usuage!
One of the programmes features is that it displays a list. The contents
of this list are the names of people that are logged into the
programme.
|
by: TefJlives |
last post by:
Hi all,
I'm learning a bit about C, and I have a few questions. I'm not trying
to insult C or anything with these questions, they're just honestly
things I don't get.
It seems like pointers to chars are just how you deal with strings, and
pointers to pointers to char just give you arrays of strings. What is
the advantage of this vs. languages with a string type?
|
by: Sonu |
last post by:
Hello -
I have the following code in my vb.net app and when it runs, the memory
usage at the Windows Task Manager keeps increasing for the application and
stops after a while. I'm using some bitmaps and sound in the program.
How would I stop the size thing to increase! I went to these link already
but I cannot fix this issue.
http://msdn.microsoft.com/en-us/library/system.idisposable.aspx...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |