Modify

Opened 17 years ago

Closed 17 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 follow-up: Changed 17 years ago by Gary

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

comment:2 in reply to: ↑ 1 Changed 17 years ago by Xenobiologist

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 follow-up: Changed 17 years ago by Jpm

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

comment:4 Changed 17 years ago by Jpm

  • Resolution set to No Bug
  • Status changed from new to closed

comment:5 in reply to: ↑ 3 ; follow-up: Changed 17 years ago by Xenobiologist

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

comment:6 in reply to: ↑ 5 Changed 17 years ago by anonymous

  • Resolution No Bug deleted
  • Status changed from closed to reopened

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 follow-up: Changed 17 years ago by jpm

can you post the limit you reach RAM/nb GUI

comment:8 in reply to: ↑ 7 Changed 17 years ago by anonymous

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 Changed 17 years ago by Valik

  • Severity set to Blocking

comment:10 Changed 17 years ago by Jon

  • Milestone set to 3.2.11.10
  • Owner set to Jon
  • Resolution set to Fixed
  • Status changed from reopened to closed

Fixed in version: 3.2.11.10

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The owner will remain Jon.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.