View previous topic :: View next topic |
Author |
Message |
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Wed Feb 01, 2006 6:53 pm Post subject: Possible Bug with Repeat Until and While Wend |
|
|
Hi All,
I am not sure if this is a bug that has been reported before. I have a simple script that just adds numbers to a list. Itermitantly I keep getting runtime error 33 Unhandled Exception "%s". Has anyone else experienced this with simple loops to add numbers?
Code: | List create,3
%%cnt = 0
%%count = 250000
%%StartTime = @datetime()
Repeat
list add,3,%%cnt
%%cnt = @Succ(%%cnt)
Until @Equal(%%cnt,%%count)
%%StopTime = @datetime()
List clear,3
Info @datetime(nn:ss,@fsub(%%StopTime,%%StartTime))@CR()Start = @datetime(t,%%StartTime)@CR()Stop = @datetime(t,%%StopTime)
Exit |
I have attached a screen shot which shows the error with Task Manager with the offending script Exe at the top of the processes list. I have seen this issue with VDS scripts that loop through large Lists of 100,000 items++. Which prompted me to write a Tree command and function but now I don't think it is the List command that is directly causing this problem. I think it is simply the Repeat Until and While Wend loops mixed with the VDS List command. Anyway I would love to read what others experiences are with this because it is just driving me crazy.
Description: |
Screen Shot of error. Note the Memory usage and Page Faults? |
|
Filesize: |
160.09 KB |
Viewed: |
1848 Time(s) |
|
_________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
WidgetCoder Contributor
Joined: 28 May 2002 Posts: 126 Location: CO, USA
|
Posted: Wed Feb 01, 2006 9:33 pm Post subject: |
|
|
It would seem there is a limit on the number of items in a list other than available mem. Using your script I found that limit on my machine was 231,585 items. Note: if you clear the list within the loop no error occures.
Regards,
Bill
|
|
Back to top |
|
|
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Thu Feb 02, 2006 1:48 am Post subject: |
|
|
dragonsphere,
i experimented with %A = @sendmsg(@win(~LIST2),$01A8,... and it worked a treat to work with really huge lists, as long as you have the ram
here is the stuff from the api manual
Quote: | LB_INITSTORAGE
Windows = (Windows NT, Windows 95, Windows 9
wParam = (WPARAM) cItems; // number of items to add
lParam = (LPARAM) cb; // amount of memory to allocate, in bytes
Message ID = $01A8
Description: Allocates memory for storing list box items. An application sends this message before adding a large number of items to a list box. This message helps speed up the initialization of list boxes that have a large number of items (more than 100). It preallocates the specified amount of memory so that subsequent LB_ADDSTRING, LB_INSERTSTRING, LB_DIR, and LB_ADDFILE messages take the shortest possible time. You can use estimates for the cItems and cb parameters. If you overestimate, some extra memory is allocated; if you underestimate, the normal allocation is used for items that exceed the preallocated amount.
Parameters
WPARAM CITEMS VALUES
Value of wParam. Specifies the number of items to add.
LPARAM CB VALUES
Value of lParam. Specifies the amount of memory to allocate for item strings, in bytes.
Return Value: The return value is the maximum number of items that the memory object can store before another memory reallocation is needed, if successful.
Sample Source Code
title TEST
DIALOG CREATE,TEST,-1,0,209,237
DIALOG ADD,BUTTON,BUTTON1,192,66,,,,DEFAULT
DIALOG ADD,LIST,LIST1,10,10
DIALOG SHOW
:evloop
wait event
goto @event()
:BUTTON1BUTTON
%A = @sendmsg(@win(~LIST1),$01A8,110,90000)
warn %A
rem Allocates 90,000 bytes of memory to add 110 items
goto evloop
:CLOSE
exit
See also:
CB_INITSTORAGE
|
from memory i could get more than 200,000 items into a list
serge
_________________
|
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Thu Feb 02, 2006 3:38 am Post subject: |
|
|
Hi All,
Thanks for your replies but the issue is not getting items in the list here. Sometimes the script above works and sometimes it does not. The real issue here is using a Repeat/Until loop or While/Wend loop with a high number of iterations while using the List commands.
_________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Thu Feb 02, 2006 2:48 pm Post subject: |
|
|
i understand what you are saying and i stick with my api suggestion as it will allow you to extend the upper number of items your list can contain + it will allow you to set the amount of memory you want to reserve so the list can contain all the items you want to add
one problem though, it won't work with 3 as a list ... i suggest that you create a list element on your gui eg. list3, hidden under another element, and use that as your list ... then the api above will help you add as many items as your ram will allow
serge
_________________
|
|
Back to top |
|
|
WidgetCoder Contributor
Joined: 28 May 2002 Posts: 126 Location: CO, USA
|
Posted: Thu Feb 02, 2006 4:23 pm Post subject: |
|
|
Dragonsphere,
You're absolutely correct the error only occurs while creating large list within a repeat or while loop. I experimented with the following Label/Goto loop and found no errors.
Code: |
List create,3
%%cnt = 0
%%count = 250000
%%StartTime = @datetime()
:TestLoop
list add,3,%%cnt
%%cnt = @Succ(%%cnt)
if @unequal(%%cnt,%%count)
goto TestLoop
end
%%StopTime = @datetime()
Info @datetime(nn:ss,@fsub(%%StopTime,%%StartTime))
list close,3
exit
|
Bill
|
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Fri Feb 03, 2006 2:30 pm Post subject: |
|
|
Serge wrote: | i understand what you are saying and i stick with my api suggestion as it will allow you to extend the upper number of items your list can contain + it will allow you to set the amount of memory you want to reserve so the list can contain all the items you want to add
one problem though, it won't work with 3 as a list ... i suggest that you create a list element on your gui eg. list3, hidden under another element, and use that as your list ... then the api above will help you add as many items as your ram will allow
serge |
Serge,
Ummm this is a fairly good work around and I guess if your program has a GUI this will work with no issue but when the VDS repeat and while combined with the list command works like it is supposed to it is much faster and does not require the overhead of a GUI interface. I need to go through 1 list over and over again that has over 260,000 items while matching text from that list with another list that is about 100,000 items. Normally I would just use a database for this kind of thing and I have actually suggested using a database to others in the past, however to perform the Join's and relations would be a nightmare in SQL since it is not just a simple query. Basicly I have to take a table and flip it sideways save one column from the table and add it to the flipped table then output the whole table as a tab delimited text file so my performance program Mercury LoadRunner can use it.
When VDS works it can do it with no trouble and fairly fast I might add but I kepted getting this error and wanted to make Jules and CR aware of it so they can fix it before VDS 6 is released while also letting others know that it exists.
BTW that is 260,000 items in each column and the tables have about 5 to 6 columns. I had to resort to using the @Text() function and parsing the whole thing looking for @CR()'s which is surprisingly much faster still.
_________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
Dr. Dread Professional Member
Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Fri Feb 03, 2006 3:10 pm Post subject: |
|
|
I stopped using VDS lists going above 100,000 items a long time ago. I use VDS quite a lot for processing
large flat-file databases. But for big lists VDS just isn't reliable. So String.DLL does the job for me now.
For that type of process String.DLL has a MatchLines function - for large lists it will be several times faster
processing the entire file than just loading the same file into a VDS list.
Greetz
Dread
_________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
Back to top |
|
|
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Sat Feb 04, 2006 12:30 am Post subject: |
|
|
dragonshere,
following your last post, i was going to suggest you check out string.dll but dr. dread beat me to it
serge
_________________
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|