Results 1 to 6 of 6

Thread: Kos /out of memory/kernel stack problem

                  
   
  1. #1
    DCEmu Newbie
    Join Date
    Oct 2005
    Posts
    23
    Rep Power
    0

    Default Kos /out of memory/kernel stack problem

    Well, i use Kos 1.2.0 dans DCfreedev patched, i load an .elf file to the dreamcast through serial coder's cable.

    After some function calls this error happens :

    KallistiOS 1.2.0: Sat Jul 12 16:52:05 2003
    La Cible@amd600:/home/kos
    thd: pre-emption enabled, HZ=100
    maple: active drivers:
    PuruPuru (Vibration) Pack: JumpPack
    VMU Driver: Clock, LCD, MemoryCard
    Mouse Driver: Mouse
    Keyboard Driver: Keyboard
    Controller Driver: Controller
    DMA Buffer at ac7005a0
    vid_set_mode: 640x480 NTSC
    fs_romdisk: mounting image at 0x8c059f40 at /rd
    dc-load console support enabled
    maple: attached devices:
    A0: Dreamcast Controller (01000000: Controller)
    vid_set_mode: 640x480 NTSC
    Requested sbrk_base 0x8d033000, was 0x8cf9d000, diff 614400
    kernel panic: out of memory; about to run over kernel stack
    arch: aborting the system



    the source is a code testing a function by calling it in a loop something like this :


    void Function{ .... };

    int main(int argc, char *argv[])
    {

    for (unsigned int count=0; count< 10;count++)
    {
    Function();
    }

    }

    the meaning of this test is to make a recursion of some functions while the user do not press a button.

    I use only local variables in the function ...


    what is wrong doing this ?

  2. #2

    Default

    Is the function loading any images and not deleting them after it's finished processing?
    Or any use of pointers that are not being freed?

  3. #3
    DCEmu Newbie
    Join Date
    Oct 2005
    Posts
    23
    Rep Power
    0

    Default

    Hi,

    The function use three types of ressource :


    1) Sdl surfaces : those surfaces are declared, the BMP images loaded, and surfaces freeing at the end of the function by the SDL function " SDL_FreeSurface() " before the "return;" statement.

    2) variables : only unsigned int which (i think) do not need to be freeing as its local declaration (in the beginning of the function.

    3) static arrays declaring like this :

    unsigned int EXEMPLE[]={value1,value2,......valueN};

    the free() function seems to be called only when malloc() is used.


    it's like this :


    void FUNCTION()
    {

    SDL_Surface *surface1,*surface2 .....;

    surface1=SDL_DisplayFormat(SDL_LoadBMP("/rd/My_image1.bmp"));
    surface2=SDL_DisplayFormat(SDL_LoadBMP("/rd/My_image2.bmp"));
    .
    .
    .
    surfaceN=SDL_DisplayFormat(SDL_LoadBMP("/rd/My_imageN.bmp"));



    unsigned int ARRAY1[]={0,4,1,0,1,2,3,4,5,4,3,2,1,0,1,2,3,4,5,6,7,8,9,1} ;
    unsigned int ARRAY2[]={0,9,1,0,7,2,3,4,5,4,3,2,1,0,1,2,3,4,5,6,7,8,9,1} ;
    .
    .
    .
    unsigned int ARRAYN[]={0,9,1,0,7,2,3,4,5,4,3,2,1,0,1,2,3,4,5,6,7,8,9,1} ;



    unsigned int Variable1, ....VariableN;


    for (unsigned int LoopCount=0; LoopCount< 639;LoopCount++)
    {
    Drawing things ....
    Calculations ...
    }

    SDL_FreeSurface(Surface1); .....SDL_FreeSurface(SurfaceN);

    return;

    }

  4. #4
    The Long Claw of the Law BlueCrab's Avatar
    Join Date
    Apr 2004
    Age
    31
    Posts
    1,215
    Rep Power
    50

    Default

    I'm willing to bet its probably the SDL surfaces. SDL is pretty buggy on the Dreamcast, and is known for leaking memory, even when you're sure you're freeing it all afterwards.
    Sylverant PSO Server
    http://crabemu.sourceforge.net/
    irc.freenode.net #dreamcastdev #dcemuuk #yabause #ljsdcdev

  5. #5
    DCEmu Newbie
    Join Date
    Oct 2005
    Posts
    23
    Rep Power
    0

    Default

    Well i think you're wright, this stack problem happens when the function try to allocate new SDL_surface : Hope there's one day a bette SDL version for DC.

    By the way, is there any function in KOS that could freeing this memory when SDL fails ? Perhaps i could use it to save me from memory holes.

    I suppose that invoquing SDL surface loading will put BMP files directly in Vram (8 mo spacing).

  6. #6
    DCEmu Newbie
    Join Date
    Oct 2005
    Posts
    23
    Rep Power
    0

    Default

    OK solved it's in kos manual video section, function that clear video page

    thanks all !

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •