Autor Beitrag
ralfi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 153



BeitragVerfasst: So 28.09.03 15:04 
Hallo!

Habe ein Problem: ich habe in meiner Progi 8-10 Threads, die eigentlich nicht besonders rechenintensive Aufgaben gleicher Art erledigen. Es ist so, dass nach ca. 10 Minuten das CPU-Auslastung stabil auf 100% und die Auslagerungsdatei ca, 560 MB groß ist. Wenn ich das Programm ausschalte, ist alles wieder in Ordnung. Was ist das und wie kann ich das verhindern?

Die kritische bereiche sind synchrinisiert, allso alles wie empfollen.

Kann es deswegen sein, dass die Threadwiederholungen mit sehr kleiner Pause (ca. 5 Sec.) arbeiten?
Andreas Pfau
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 997



BeitragVerfasst: So 28.09.03 19:40 
Hallo,

hört sich nach schlechtem Speichermanagment an. Kennst du Memproof? Ich würde das mal ausprobieren! Oder zeige doch mal den Quellltext, da muss doh cwas dran sein!

Memproof: www.automatedqa.com/downloads/memproof.asp

_________________
Life is a bad adventure, but the graphic is really good!
ralfi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 153



BeitragVerfasst: So 28.09.03 22:12 
Ich habe mein Progi mit MemProof getestet. Dem Ergebniss glaube ich nicht ganz. Das System wird überlastet, wenn die Threads Dalay-Pocedur aufrufen.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TForm1.Delay(MSec: Longint);
var Start, Stop: Longint;
begin
  Start := GetTickCount;
  repeat
    Stop := GetTickCount;
    Application.ProcessMessages;
  until (Stop - Start ) >= msec;
end;

Wenn die procedur aufgerufen wird, steigt die CPU-Auslastung auf 100%, wenn die Pause vorbei ist, steigt diese auf 2% ab. Was ist das den?

Kann diese Procedur so viel Recourcen brauchen? Wie kann ich sonst die Pause zwieschen Thread-Wiederholungen realisieren?

Moderiert von user profile iconTino: Code- durch Delphi-Tags ersetzt.
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: So 28.09.03 23:34 
In diesem Code hast du sowas wie eine Endlosschleife die solange läuft wie sie Rechenzeit bekommt... änder sie so um:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
procedure TForm1.Delay(MSec: Longint);
var Start, Stop: Longint;
begin
  Start := GetTickCount;
  repeat
    Stop := GetTickCount;
    Application.ProcessMessages;
    Sleep(1); // <- Rechenzeit freigeben
  until (Stop - Start ) >= msec;
end;

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!
barfuesser
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 324



BeitragVerfasst: Mo 29.09.03 08:41 
Warum benutzt Du eigentlich nicht gleich sleep anstatt Deiner selbstgeschriebenen Delay-Methode?

barfuesser