------mjpeg.c------- help!

Hi!

I’m using mjpeg.c to display a *.mjpeg file on my disk…
It works for a moment (depending on which computer i’m using but usually
round 30 sec to 4 min) and then it carshes at this line :

char *mjpeg_read(FILE *src)
{
char *ptr = NULL;
ptr = (char *)malloc(FRAME_MAXIMUM_LEN);

}
where FRAME_MAXIMUM_LEN is : #define FRAME_MAXIMUM_LEN (100 * 1024)

This malloc fonction returns NULL at a moment and i don’t know why.
please help me !!_________________________________________________________________
Rejoignez le plus grand service de messagerie au monde avec MSN Hotmail.
http://www.hotmail.com

Sounds like your running out of memory, are you freeing the buffer that your
allocating after use ? Since malloc can be pretty slow if your continually
malloc and then free, you might try allocating say ten buffers to start with
and just keep recycling them. You should then be able to see how your program
is working with regard with timing and maybe go down to 2 or 3 buffers.

HTH
AndyOn Sunday 12 May 2002 16:54, olivier caignart wrote:

Hi!

I’m using mjpeg.c to display a *.mjpeg file on my disk…
It works for a moment (depending on which computer i’m using but usually
round 30 sec to 4 min) and then it carshes at this line :

char *mjpeg_read(FILE *src)
{
char *ptr = NULL;
ptr = (char *)malloc(FRAME_MAXIMUM_LEN);

}
where FRAME_MAXIMUM_LEN is : #define FRAME_MAXIMUM_LEN (100 * 1024)

This malloc fonction returns NULL at a moment and i don’t know why.
please help me !!

do you use c++?
I have problems mixing new and malloc.

If you use c++ change
ptr = (char *)malloc(FRAME_MAXIMUM_LEN);
by
ptr = new char[FRAME_MAXIMUM_LEN];

El dl, 13-05-2002 a las 01:54, olivier caignart escribi?:

Hi!

I'm using mjpeg.c to display a *.mjpeg file on my disk...
It works for a moment (depending on which computer i'm using but usually 
round 30 sec to 4 min) and then it carshes at this line :


char *mjpeg_read(FILE *src)
{
    char           *ptr    = NULL;
    ptr = (char *)malloc(FRAME_MAXIMUM_LEN);
...
}
where FRAME_MAXIMUM_LEN is : #define FRAME_MAXIMUM_LEN  (100 * 1024)

This malloc fonction returns NULL at a moment and i don't know why.
please help  me !!_________________________________________________________________
Rejoignez le plus grand service de messagerie au monde avec MSN Hotmail. 
http://www.hotmail.com


_______________________________________________
SDL mailing list
SDL at libsdl.org

http://www.libsdl.org/mailman/listinfo/sdl