HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Array Size actually 8191 !??

08-22-2006, 02:51 PM#1
Vexorian
All right, remember the bug that makes CSCache crash when loading a saved game?

The bug was on InitArrayIndexes, and I traced it more and found out even more

Collapse JASS:
    loop
        exitwhen (i== 8192)
        set udg_csarray1[i]=777
        set udg_csarray2[i]=777
        set udg_csarray3[i]=777
        set i=i+1
    endloop

Disabling those lines stopped the crash, what's more bizarre is that replacing that 8192 to 8191 also fixes the issue, could it be that there is a bug when loading saved games that let's arrays have 8191 of size instead of 8192?

This could be a memory problem that causes this behaviour, I have not time for now until the afternoon so I guess I am gonna leave the questin open and see if somebody else can answer it for me
08-22-2006, 02:56 PM#2
DioD
0 + 8191 = 8192 ?

you can set array index to zero soo it count too
08-22-2006, 03:19 PM#3
Toadcop
Quote:
0 + 8191 = 8192 ?
=) yep ! it's true ! but i would say it's a lame "bug" i must too fix it in my sys's... =) i am so stupid =(
08-22-2006, 03:20 PM#4
blu_da_noob
That loop vex shows initialises the arrays from 0 to 8191 (8192 is not set).
08-22-2006, 03:25 PM#5
Zoxc
When loading/saving for the secound time is the *limit* still 8191?
08-22-2006, 03:44 PM#6
Vexorian
Quote:
Originally Posted by DioD
0 + 8191 = 8192 ?

you can set array index to zero soo it count too
You are confusing max index with array size.

I forgot to include the set i=0 before the loop.

In that example the initialized indexes are 0...8191 , which are 8192.

But it causes crashes. When I replace the 8192 in the exitwhen with 8191 the indexes initialized are 0...8190 and those are 8191 elements in the array and it does not crash
08-22-2006, 03:52 PM#7
Vexorian
Quote:
Originally Posted by Zoxc
When loading/saving for the secound time is the *limit* still 8191?
yes
08-22-2006, 03:54 PM#8
Vexorian
A map with just this trigger on map initialization will crash when loading a saved game:

Collapse JASS:
function Trig_Melee_Initialization_Actions takes nothing returns nothing
 local integer i=0
    loop
exitwhen i==8192
   set udg_ia[i]=1
   set i=i+1
endloop
endfunction

//===========================================================================
function InitTrig_Melee_Initialization takes nothing returns nothing
    set gg_trg_Melee_Initialization = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Melee_Initialization, function Trig_Melee_Initialization_Actions )
endfunction

08-22-2006, 03:55 PM#9
Toadcop
Quote:
8191 elements in the array and it does not crash
- ? strange ? i don't think waht blizz a full lame any write JASS_ARRAY_MAX_SIZE=8192 ! try it separate ! or better i will test it...
Code:
function Trig_Melee_Initialization_Actions takes nothing returns nothing
 local integer i=0
    loop
exitwhen i==8192
   set udg_ia[i]=1
   set i=i+1
endloop
endfunction
i correct me Blizz a full lamers =)
08-22-2006, 04:11 PM#10
blu_da_noob
Have you checked on the ability to read back from index number 8191? Perhaps the actual arrays sizes are 8191, but these are only 'enforced' with out of range crashes after loading (for some weird reason).
08-22-2006, 04:41 PM#11
DioD
If out of range data stored somewhere its nice.
08-22-2006, 05:26 PM#12
PipeDream
Looks like it's enough just to set index 8191 or read it.

guess we should have all been using JASS_MAX_ARRAY_SIZE so that we could turn it down to 8191. How annoying.
08-22-2006, 05:51 PM#13
Vexorian
When saving/loading games is not involved, I can read and write indexes 0 to 8191 without any problem, using other indexes does not crash but when you read the value it will always be 0. I think it can crash the thread sometimes, but that is not necessarily true.

Edit: This bug must be new, some time ago (before gamecache) using all the space of an array was frequent, and I don't remember anyone talking about this bug.