[comp.sys.amiga] SuperBitMap Windows

jan@oscvax.UUCP (Jan Sven Trabandt) (01/22/88)

howdy, y'all.

I'm having a wee memory problem (about 130.4K of it)

I have this superbitmap window, right?
I AllocMem() a bitmap struct.
I AllocRaster() two bit planes for it, which total 130.4K
I keep a pointer to the bitmap struct around so I can free it later.
I can open the window fine (the gimmezerozero flag is also set).

After the window is used and the close gadget is selected I want
to clean things up...
Now how the f*** do I free the memory of my 2 bitmap planes????

conceptually it should be done after I do a CloseWindow(), right?
(I tried to do it before and it guru'd)

when I try to do a FreeRaster() on the two bitmap planes
(before I FreeMem() the bitmap struct <--this part works fine),
it guru's on me saying that the memory has already been freed
(when I try to FreeRaster the first bitmap plane)
(guru# 0x81000009.???) but when I quit the program, WorkBench tells
me i've lost 130.4K of memory.

Help me.

Thanks in advance,
Jan Sven.

-- 
"Violence is the last resort of the incompetent"
	- Harry Seldon, The Foundation Trilogy  (Isaac Asimov)

Mind like parachute  -  function only when open!

Jan (Jan, from Amsterdam) a.k.a. Sven Trabandt
see also: Ian, Dan, John, Dave
...!{allegro,ihnp4,decvax,pyramid}!utzoo!oscvax!jan

P.S. Just who is this guy, anyways?

carolyn@cbmvax.UUCP (Carolyn Scheppner CATS) (01/26/88)

In article <566@oscvax.UUCP> jan@oscvax.UUCP (Jan Sven Trabandt) writes:
>howdy, y'all.
>
>I'm having a wee memory problem (about 130.4K of it)
>
>I have this superbitmap window, right?
>I AllocMem() a bitmap struct.
>I AllocRaster() two bit planes for it, which total 130.4K
>I keep a pointer to the bitmap struct around so I can free it later.
>I can open the window fine (the gimmezerozero flag is also set).
>
>After the window is used and the close gadget is selected I want
>to clean things up...
>Now how the f*** do I free the memory of my 2 bitmap planes????
>
>conceptually it should be done after I do a CloseWindow(), right?
>(I tried to do it before and it guru'd)
>
>when I try to do a FreeRaster() on the two bitmap planes
>(before I FreeMem() the bitmap struct <--this part works fine),
>it guru's on me saying that the memory has already been freed
>(when I try to FreeRaster the first bitmap plane)
>(guru# 0x81000009.???) but when I quit the program, WorkBench tells
>me i've lost 130.4K of memory.

You must be doing something wrong.  Check your FreeRaster() call.

Are you passing the correct arguments (i.e. the ptr that was returned
by the matching AllocRaster, bit width of plane, bit height of plane) ?

Are you correctly getting the ptr to each plane from the PlanePtr array
in the BitMap struct (where you should have stored them from AllocRaster) ?

Are you clearing all of the PlanePtrs in that array prior to using
AllocRaster so you can safely assume during cleanup that any non-NULL
PlanePtr is a plane you must FreeRaster ?

I use AllocRaster and FreeRaster in with no problem in SuperBitmap.c 
(Fish Disk 28).

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Carolyn Scheppner -- CATS   >>Commodore Amiga Technical Support<<
                     UUCP  ...{allegra,ihnp4,rutgers}!cbmvax!carolyn 
                     PHONE 215-431-9180
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=