[comp.sys.mac.programmer] Where did I go wrong

wolf@mel.cipl.uiowa.edu (08/08/90)

What I am doing is loading several resources, two are 8k and the rest are less
than 1k all together.  I do not lock the handles and I do not set HNoPurge (I'm
using turbo Pascal).

With the data I am taking a bitmap image (which was one of the loaded
resources).  I set up the bitmap just fine (as I have used it before).  Then
with the 8k of data I use like a 2D array and use CopyBits to build an image to
a window which is 108 pixels square.  This worked fine.  

The problem and wierd stuff...

I had an extra bitmap from previous testing which was large (98k), I wasn't
doing anything with it.  When I had done what I described above, I got rid of
this large bitmap as I didn't need it.  This is when wierd things started
happenning.

The program would work for a moment but when I would do the CopyBits to build
the next image it would say memory full error.  Well, I have 2.5M so I thought
it was funny.  So I did a compact mem and that seemed to help for a little
while then the program would wig out.  When I put a large variable back in it
appeared to work fine again.  I tried locking and setting NoPurge on the
Handles to the resources, I also checked the application heap limit, etc.

I can't imagine that I am using up memory.  Or even reallocating more and more
memory and having it take up the 2.5M.

One other wierd thing was where I had SysBeep(1) in an If statement, the Beep
would happen but the system would crash right afterward.

It seems that memory is getting overwritten or the like, but I couldn't see
where.

Are there standard set-ups for doing what I am trying, like how to allocate the
memory or lock it or access it?  This thing has me boggled.

Sorry to be so long winded, but any help would be appreciated.   Thanks!

Michael