View Full Version : LockPool and LockQueue Memory Tester (for PropTerm)

09-19-2007, 04:17 AM
I struggled with getting the LockQueue and LockPool to work together for some time and ended up writing this test program which made it easier to test the configuration of the two objects. The concept is to use the LockQueue to store the pointers created by allocations to the LockPool. This effectively gives you a way to track any number of memory allocations provided you've created enough space for the queue, the pool and the hole table. This demo sets up the objects and runs a memory viewer on the main cog, then it starts another cog that allocates memory until either the Queue or the Pool fills up (or the program runs out of stack space). If the Queue or Pool fills up, then the first cog stops itself and the main cog starts another cog that pops the queue and frees the pool until there are no more allocations (ie all the objects have been removed). You can play with the size of the displayRAM, vcStack, and drQueTable as well as the dSize (data allocation size) to see the results of changing these values for your required configuration. If the program succesfully fills up the entire pool and then empties it out, chances are you have a good configuration that doesn't run out of Stack, or Queue space. If the queue gets full before your Pool is used up, you need to allocate a larger Queue or change your allocation size etc. Now on to actually using these powerful tools!

(btw, Thank you to Chad George for writing these great objects!)

Post Edited (mcstar) : 9/19/2007 12:50:58 AM GMT

09-20-2007, 09:48 PM
Here's an updated version of the memory tester. Unfortunately, it's got a more specialized interface, but perhaps it will be helpful to someone. The Display is done via a 4-line parallel LCD operating in 4-bit mode and input is passed in via an IR detector and a Sony TV\VCR remote. Use the VCR "slow" key to reduce the size of the data blocks allocated, and use the x2 key to increase the data block size. The "Play" button will start the allocation COG and results are displayed on the LCD. It should be pretty easy to modify it to work with TV or VGA display. Just change all the LCD. commands to somthing more appropriate.

EN - P5
RS - P4
[D4 - D7] - [P3-P0]
input - P12

Chad George
09-21-2007, 07:20 PM
Glad to see it getting used. I haven't gotten a chance to get back to the project I actually wrote them for.

I'm glad you worked on testing everything out. That was definitely one area that I hadn't finished yet.

And you got LockPool and LockQueue to play nicely together. I intended them too, but had only used/tested them
seperately so far.