|
- Forum - iziBasic
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 257
Sujet n° 1145 |
Problem with PP call? |
le 05/03/2005 @ 18:05 par Steven
|
I'm working on a program that plots a bitmap at 160x160 or 320x320. The plots took too long in iziBasic (but much faster than PocketC ) so I coded the appropriate functions using PP. While I was developing the PP code I kept everything at 160x160 and everything worked well. Once I had everything working I changed one array in PP from 160 bytes to 320 bytes. Now it works but when I exit the iziBasic program I get
"MemoryMgr.c, Line:3757, Invalid chunk ptr".
It happens whether I plot at 160x160 or 320x320. I don't understand how changing the array size affects this; 320 bytes isn't all that much! Any ideas? |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 1 -------- le 05/03/2005 @ 20:18 par aldweb
visiteur |
Hello Steven,
Thanks for confirming that iziBasic is much faster than PocketC. This was quite expected anyway (see here: Bench2 analysis).
Without having a look at your PP source code, it is quite hard to help you.
You talk of a 320 bytes size change. But, as from reading you, I understand that: 1. a 160x160 byte array is a 25,600 bytes long array, roughly 25 KB. 2. a 320x320 byte array is a 102,400 bytes long array, roughly 100 KB, so 4 times bigger than the previous one! And it overpasses the 64 KB common segment size on Palm OS or the 32 KB data segment size of PP.
Cheers
@+ aldweb |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 2 -------- le 05/03/2005 @ 22:54 par Steven
visiteur |
I explained badly, it's not a 2 dimensional array. Only one dimension, so 160 bytes or 320 bytes plus there are two of them so 320 or 640. I changed my arrays from integer to UInt8 and it appears to be working, but let me ask a question. If I have a procedure defined prior to my CallPP function as:
type myarray = array[0..320] of UInt8;
procedure myprocedure( var array1 : myarray);
. . . function CallPP(.....);
Is this a problem? |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 3 -------- le 05/03/2005 @ 23:57 par aldweb
visiteur |
The PP integer type is a 32 bits integer type and it uses 4 bytes, when a byte (UInt8) uses 1 byte (2nd case seems obvious!). So, array[0..320] is 321 bytes big, when it was 321x4=1284 bytes before.
We will have to check how much space of local variables is given in a PP module, out of the 32KB global variables space which is reserved by iziBasic.
You may very well declare many procedures and functions before the CallPP function itself.
Cheers
@+ aldweb |
|
|
sujet actif
sujet clos
Important!
Nouveau message -
Rectifier message
Clôturer sujet
Remonter
|
|