| View previous topic :: View next topic |
| Author |
Message |
JJPeerless
Joined: 20 Jun 2005 Posts: 82
|
Posted: Sat Sep 10, 2005 5:34 am Post subject: |
|
|
ok yea..that was a bad example.. well im not sure why what is happening to me is happening then.. i load up say maybe 40-50 pictures..different sized pictures..and free them all eventually.. and in the same program i load up a mp3 file, and play it.. it crashes..if i try a small mp3 file, it works fine..
now if i take the code that plays the mp3 file into a separate program..the big mp3 file will load and play fine.. so that leaves me to beleive the images i load and free..are not clearing memory completly..or is there some way i can .. like defrag the memory..heh.. so the mp3 has room to be loaded into? |
|
| Back to top |
|
 |
Shine
Joined: 03 Dec 2004 Posts: 728 Location: Germany
|
Posted: Sat Sep 10, 2005 5:43 am Post subject: |
|
|
| I don't know how to defrag the memory, but this is a PSPSDK related question, I've splitted your posting to this forum. |
|
| Back to top |
|
 |
jpadams

Joined: 02 Jul 2005 Posts: 23 Location: Los Angeles
|
Posted: Sat Sep 10, 2005 6:31 am Post subject: |
|
|
are your malloc's aligned ?
thats the easiest way to cause a crash |
|
| Back to top |
|
 |
CyberBill
Joined: 26 Jul 2005 Posts: 86 Location: Redmond, WA
|
Posted: Mon Sep 12, 2005 12:55 pm Post subject: |
|
|
Call malloc/free as few times as possible. If you are loading up a bunch of bitmaps, load up enough memory to hold your framebuffer ( 480x272x4bytes ) and write to that buffer whenever you load up an image. When you load the image, call malloc to grab enough memory to hold the file and then free it imediately afterwards, or better yet make a dedicated file-read buffer that is only created once.
This will cut down on the amount of memory fragmentation. Remember, you've only got about 20MB of real RAM to work with once your executable is loaded up. This is NOT a lot! |
|
| Back to top |
|
 |
Jim

Joined: 02 Jul 2005 Posts: 487 Location: Sydney
|
Posted: Mon Sep 12, 2005 10:37 pm Post subject: |
|
|
It's a lot more than PS1!! And we fitted a lot in that. As long as we have the reasonable expectation that if we free everything we malloc there is no fragmentation that is OK. And as long as the C++ object allocations aren't mental then there is some chance of reliable software.
Jim
PS. It's a lot more ram than N64 and DC. _________________ http://www.dbfinteractive.com |
|
| Back to top |
|
 |
|