Announcement

Collapse
No announcement yet.

What means STACK Trap?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • kapsreiter
    replied
    Looks like that fix the crash

    thank you
    Last edited by kapsreiter; 4 March 2018, 06:24 PM.

    Leave a comment:


  • kapsreiter
    replied
    hi

    where could i ad this?


    could you please copy paste it to the posted code?

    thx

    Leave a comment:


  • Jerson
    replied
    Hello Kapsreiter,

    Stack Trap will occur if the RAM is full during runtime. It seems that you are not releasing the handles on each GCI file with the file_LoadImageControl. You can release the file handling memory by adding this function: mem_Free(hndl); this can be found at page 401 of the DIABLO16 InternalFunctions pdf. You should insert this line once you go to another file. In your code it should be after the for-next loop for each case.

    Best regards.

    Leave a comment:


  • kapsreiter
    started a topic What means STACK Trap?

    What means STACK Trap?

    Hi

    i use this code to play random short videos from a sd card, they are short only 30 sec or so

    after about 5 minutes i get this error and the display freezre


    anyone could help me how to fix this, i am not a developer, sorry

    tom
    -----------------------------------------------------------------------------------------------------------------------

    #platform "Gen4-uLCD-24D"

    // Program Skeleton 1.3 generated 28.02.2018 22:50:07

    #inherit "4DGL_16bitColours.fnc"

    #inherit "VisualConst.inc"

    #inherit "videoConst.inc"

    func main()
    var frame, frames ;
    var VideoIndex;

    putstr("Mounting...\n");
    if (!(file_Mount()))
    while(!(file_Mount()))
    putstr("Drive not mounted...");
    pause(200);
    gfx_Cls();
    pause(200);
    wend
    endif
    gfx_ScreenMode(LANDSCAPE) ; // change manually if orientation change
    gfx_Cls();

    repeat
    VideoIndex := RANDVAL(0,5); // Select Random Video number

    switch ( VideoIndex )

    case 0:
    hndl := file_LoadImageControl("Video1.dat", "Video1.gci", 1);
    frames := img_GetWord(hndl, iVideo1, IMAGE_FRAMES);
    for (frame := 0; frame < frames; frame++)
    img_SetWord(hndl, iVideo1, IMAGE_INDEX, frame) ;
    img_Show(hndl,iVideo1) ;
    //pause(1) ; // delay after each frame, does not include time to actually display frame
    next
    break;

    case 1:
    hndl := file_LoadImageControl("Video2.dat", "Video2.gci", 1);
    frames := img_GetWord(hndl, iVideo1, IMAGE_FRAMES);
    for (frame := 0; frame < frames; frame++)
    img_SetWord(hndl, iVideo1, IMAGE_INDEX, frame) ;
    img_Show(hndl,iVideo1) ;
    //pause(1) ; // delay after each frame, does not include time to actually display frame
    next
    break;

    case 2:
    hndl := file_LoadImageControl("Video3.dat", "Video3.gci", 1);
    frames := img_GetWord(hndl, iVideo1, IMAGE_FRAMES);
    for (frame := 0; frame < frames; frame++)
    img_SetWord(hndl, iVideo1, IMAGE_INDEX, frame) ;
    img_Show(hndl,iVideo1) ;
    //pause(1) ; // delay after each frame, does not include time to actually display frame
    next
    break;

    case 3:
    hndl := file_LoadImageControl("Video4.dat", "Video4.gci", 1);
    frames := img_GetWord(hndl, iVideo1, IMAGE_FRAMES);
    for (frame := 0; frame < frames; frame++)
    img_SetWord(hndl, iVideo1, IMAGE_INDEX, frame) ;
    img_Show(hndl,iVideo1) ;
    //pause(1) ; // delay after each frame, does not include time to actually display frame
    next
    break;

    case 4:
    hndl := file_LoadImageControl("Video5.dat", "Video5.gci", 1);
    frames := img_GetWord(hndl, iVideo1, IMAGE_FRAMES);
    for (frame := 0; frame < frames; frame++)
    img_SetWord(hndl, iVideo1, IMAGE_INDEX, frame) ;
    img_Show(hndl,iVideo1) ;
    //pause(1) ; // delay after each frame, does not include time to actually display frame
    next
    break;

    // To expand, just add more cases here

    endswitch
    forever
    endfunc
Working...
X