Image allocating goes wrong.

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
jojojoris
Posts: 255
Joined: Sun Mar 30, 2008 4:06 am

Image allocating goes wrong.

Post by jojojoris »

Hello everyone,

I am writing a game (duhh) but i got a strange problem. If i run this program in psplink it starts well. but after i started the menu about 7 times (starting tic tac toe) the background turns black and not all images are loaded anymore. It seems it crashed when i use "free(img->data)". When i run the program from my memorstick the whole background turns black and only two of the images are shown.

When it is unable to create the images every free() crashes.

Here are my complete sources. (My sound and image files are not included)
http://school.deparmey.nl/joris/TTTAOS.zip

The sources are in the src folder.
JDF/jdf.cpp is a file wchich contains code for my own Image file format (which contains RAW uncompressed data which i can copy direct to the ram.
GFX/jgfx.cpp contains the graphical part of my code.
The other files are obvious.

Can someone see what is the cause why it crashes?
and
Why does ik work (better) in PSPLINK?

PS. I know the loadingscreen is not verry useful at this time. But it is vissible for testing purposes to see if it is just working.

PSPS. I am also not quite sure what i have to use. delete of free().

Code: Select all

int main(){
     SetupCallbacks();
     makeNiceGame();
     sceKernelExitGame();
}
User avatar
Jim
Posts: 476
Joined: Sat Jul 02, 2005 10:06 pm
Location: Sydney
Contact:

Post by Jim »

Almost perfect description of memory leak/heap corruption.

Jim
jojojoris
Posts: 255
Joined: Sun Mar 30, 2008 4:06 am

Post by jojojoris »

Jim wrote:Almost perfect description of memory leak/heap corruption.

Jim
On another forum i asked the sam question the said i screwed all the malloc/memset/free/delete up.

I fixed it now. It runs normal now

Code: Select all

int main(){
     SetupCallbacks();
     makeNiceGame();
     sceKernelExitGame();
}
Post Reply