Home > Back-end >  Win 7 writing files, system memory can increase, I use system is Windows 7 64 bit
Win 7 writing files, system memory can increase, I use system is Windows 7 64 bit

Time:10-20

In Windows 7 64 - bit, using c + + builder6.0 wrote a document saving program, the timer in the corresponding function a FileWrite 20 m size data, time interval timer 1000 ms, when start to write the file system memory has been on the rise, stop writing files, system memory began to decrease, then using fwrite, system memory will increase, the use of vc CFile classes, memory or increase, don't know what reason is this, o great god help, recently there is a project, request inventory speed is 200 m not seconds, there is no question of disk save speed, is the beginning of inventory, is win 7 64 - bit system memory has been increased, increase particularly high, software card dead, system is very card, don't know why, how to improve, ask god for help

CodePudding user response:

Under the xp? Under Windows 7 x86? Must also under test,

Stick your inventory code, an also to test the test

CodePudding user response:



reference 1st floor sololie response:
under xp? Under Windows 7 x86? Must also under test,

Stick your inventory code, an also to test the test







Code is very simple, just test, under the xp memory doesn't increase,
The code below

Global variables:

Int File_Num;
An int Array [266144].

In the constructor:

for(int i=0; i<266144; I++)
{
Array [266144]=I;
}
File_Num=FileCreate (" data. Bin, "fmOpenReadWrite);
Fomr1 - & gt; Timer1 - & gt; Enabled=true;//have a timer, is off by default, open here, the timer interval is 1000 ms,

Timer corresponding functions:

for(int i=0; i<40; I++)
{
FileWrite (File_Num, Array, 0 x100000);
}

Closed program:

Form1 - & gt; Timer1 - & gt; Enabled=false;
FileClose (File_Num);

//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Code that's it, I spent a lot of writing function, used the write, fwrite, WriteFile, the results are the same, are under the Windows 7 64 - bit system memory increases, increased to a certain value after does not increase, but the actual program is also an inventory process, increase the value of the special large memory, finally results in a special card system, affect the program, under the Windows 7 x86'll try

CodePudding user response:

Since you said no problem under xp, that I also don't try, because I have only xp, no 64 - bit environment,
Old demon for you will still have to solve the

CodePudding user response:

Oh, thank you, same to win 7 32 memory increase

CodePudding user response:

If have any handle to close or unreleased resources

CodePudding user response:

Try:

Form1 - & gt; Timer1 - & gt; Enabled=false;
for(int i=0; i<40; I++)
{
FileWrite (File_Num, Array, 0 x100000);
}
Form1 - & gt; Timer1 - & gt; Enabled=true;

CodePudding user response:

reference 5 floor ksrsoft reply:
is ever handle to close or unreleased resources

Don't know, so point code, no dynamic memory application

CodePudding user response:

refer to 6th floor gzliudan response:
try:

Form1 - & gt; Timer1 - & gt; Enabled=false;
for(int i=0; i<40; I++)
{
FileWrite (File_Num, Array, 0 x100000);
}
Form1 - & gt; Timer1 - & gt; Enabled=true;



Just write a 40 m, increased memory didn't increase the basic look not to come out

CodePudding user response:

User layer to write data to the hard disk, and eventually is called Windows driver, you can only to a certain extent by CreateFile to specify how to write the data, write data in the process of the operating system will be according to the need to increase, reduce the need to cache,

Specific look at the CreateFile function in detail,
  • Related