Modify

Opened 18 years ago

Closed 18 years ago

#185 closed Bug (Fixed)

Limit of GUI Controls -> (eat up CPU)

Reported by: Xenobiologist Owned by: Jon
Milestone: 3.2.11.10 Component: AutoIt
Version: 3.2.11.2 Severity: Blocking
Keywords: Limit GUI Cc:

Description

Hi,

on my CPU 1,8 Ghz Pentium M XP SP 2 I cannot create 300 GUIs. CPU is 100 %.

#include<WindowsConstants.au3>

;~ Maximum number of GUI windows: No limit ????

HotKeySet('{ESC}', '_end')
HotKeySet('1', '_create')
HotKeySet('2', '_idle')

_create()

Func _create()
	For $i = 0 To 1000
		GUICreate($i, Random(10, 100, 1), Random(10, 50, 1), _
				Random(0, @DesktopWidth - 110, 1), Random(0, @DesktopHeight - 60, 1), _
				$WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST))
		GUISetBkColor(_randomColor())
		GUISetState()
		ToolTip($i, 0, 0)
		Sleep(5)
	Next
EndFunc   ;==>_create

Func _idle()
	ConsoleWrite('! idle' & @CRLF)
	While 1
		Sleep(10000)
	WEnd
EndFunc   ;==>_idle

Func _randomColor()
	Return Random(0x000000, 0xFFFFFF)
EndFunc   ;==>_randomColor

Func _end()
	Exit (0)
EndFunc   ;==>_end

Link thread :http://www.autoitscript.com/forum/index.php?showtopic=66925

Mega

Attachments (0)

Change History (10)

comment:1 by Gary, 18 years ago

I thought the limit of GUIs was changed to 16, but the help file states "Unlimited"

in reply to:  1 comment:2 by Xenobiologist, 18 years ago

Yes, and the funny thing is, after having reached 100 % CPU, switching to the idle function which has only a 10 sec sleep, the CPU stays at 100 %. It seems that after a certain amount of GUIs the organization of them eats up the CPU.

comment:3 by J-Paul Mesnage, 18 years ago

According to other AutoIt Dev that's a Window behavior. No bug from AutoIt side !!!

comment:4 by J-Paul Mesnage, 18 years ago

Resolution: No Bug
Status: newclosed

in reply to:  3 ; comment:5 by Xenobiologist, 18 years ago

Replying to Jpm:

According to other AutoIt Dev that's a Window behavior. No bug from AutoIt side !!!

Window or Windows? I guess, you meant Windows. So, it depends on the CPU and RAM and Windows version how many GUIs I can create? I will try to translate the script into Java or Perl and see how many GUIs I can create that way.

Mega

in reply to:  5 comment:6 by anonymous, 18 years ago

Resolution: No Bug
Status: closedreopened

Hi,

I tried it with Java. No problem here. I can create as much GUI controls as RAM can handle. Many many more than Autoit can do.

Mega

comment:7 by J-Paul Mesnage, 18 years ago

can you post the limit you reach RAM/nb GUI

in reply to:  7 comment:8 by anonymous, 18 years ago

Replying to jpm:

can you post the limit you reach RAM/nb GUI

Hi,

even better. :-) It seems to have nothing to do with CPU or RAM. I've got a new Laptop with dual core 2,2 Ghz and 2 GB of RAM (XP SP2) latest Autoit beta. Autoit stopps at ~ 260 GUIs. Java has no problem creating 500 or more GUIs.

import java.awt.Color;
import java.util.Random;

import javax.swing.JFrame;

public class _createGUI {
	private JFrame fenster;

	public _createGUI(int i) {
		fenster = new JFrame("Fenster");
		Random generator = new Random();
		Color c = new Color(generator.nextInt(256), generator.nextInt(256), generator.nextInt(256));
		fenster.setTitle(Integer.toString(i));
		fenster.getContentPane().setBackground(c);
		fenster.setAlwaysOnTop(true);
		fenster.setSize(generator.nextInt(180), generator.nextInt(200));
		fenster.setLocation(generator.nextInt(1000), generator.nextInt(700));
		fenster.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		fenster.setVisible(true);
	}

	public static void main(String[] args) {
		for (int i = 0; i < 500; i++) {
			_createGUI g = new _createGUI(i);
		}
	}
}

Mega

comment:9 by Valik, 18 years ago

Severity: Blocking

comment:10 by Jon, 18 years ago

Milestone: 3.2.11.10
Owner: set to Jon
Resolution: Fixed
Status: reopenedclosed

Fixed in version: 3.2.11.10

Modify Ticket

Action
as closed The owner will remain Jon.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.