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 1245
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.com> 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.com> 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.com> 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 ProcessDataRetriever
{
public static string[] GetData(string cmd, string args)
{
using(Process p = new Process())
{
ProcessStartInfo psi = new ProcessStartInfo(cmd, args);
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
psi.WindowStyle = ProcessWindowStyle.Hidden;
psi.CreateNoWindow = true;
p.StartInfo = psi;
p.Start();
ArrayList a = new ArrayList(); string s;
while((s = p.StandardOutput.ReadLine()) != null) a.Add(s);
p.Close();
return (string[])a.ToArray(typeof(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.com" 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.com" 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\directory\name\goes\here");
FileSystemInfo[] allfiles= di.GetFileSystemInfos();
FileSystemInfo oldestfile = null;
foreach (FileSystemInfo fiNext in allfiles)
{
if ((fiNext.Attributes & FileAttributes.Directory) == 0)
// exclude directories
{
if (oldestfile == null)
oldestfile = fiNext;
else
if (fiNext.GetLastWriteTimeUtc <
oldestfile.GetLastWriteTimeUtc)
oldestfile = fiNext;
}
}
return fiNext.FullName;
"Beeeeeeeeeeeeves" <Be**************@discussions.microsoft.com> wrote in
message news:1C**********************************@microsof t.com... I have this class which will list the output of a dos command to a string
array: public class ProcessDataRetriever { public static string[] GetData(string cmd, string args) { using(Process p = new Process()) { ProcessStartInfo psi = new ProcessStartInfo(cmd, args); psi.UseShellExecute = false; psi.RedirectStandardOutput = true; psi.WindowStyle = ProcessWindowStyle.Hidden; psi.CreateNoWindow = true; p.StartInfo = psi; p.Start(); ArrayList a = new ArrayList(); string s; while((s = p.StandardOutput.ReadLine()) != null) a.Add(s); p.Close(); return (string[])a.ToArray(typeof(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.com" 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...
|
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....
|
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...
|
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...
|
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...
| |
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...
|
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...
|
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...
|
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...
|
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,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
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...
| |