[futurebasic] Re: [FB] FB^3 Memory and Temp file questions

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 2000 : Group Archive : Group : All Groups

From: Osamu Shigematsu <shigematsu@...>
Date: Mon, 30 Oct 2000 19:05:56 +0900
Hello, Robert.

on 00.10.30 5:53 PM, Robert Covington at artlythere@... wrote:

> Helpful people (I hope)
> 
> I have 2 things I would appreciate more info on if possible:
> 
> * Dynamic memory allocation for a GWorld for instance.
> 
> Say with a 32 Bit Gworld, 1600*800*4, would be like 5120000 bytes, right?
> (5.1 MB)

Sometimes right and sometims wrong. Required size will be rowBytes * line
numbers.

> If MEM(_maxAvail) or MEM(_freeBytes) indicate that only 2 MB are available
> to the App, is there a way to check the available machine memory to see how
> much extra is available there, and allocate a portion of that to the app so
> that the GWorld can then be built?

You are able to obtain memory form system heap with useTempMemBit.

    QDErr err = NewGWorld(&world, 32, &rect, nil, nil, 1<<useTempMemBit);

// this is C sample code

I guess in FB^3, we can do this following code.

    DIM err AS SHORT
    err = FN NEWGWORLD(world, 32, rect, _nil, _nil, 4)

> For instance, above example, but machine and current apps, see somehow that
> the largest unused block of RAM is 36 MB, then  grab 10 MB of that for
> example? Otherwise, bail.
> * Item 2
> 
> Anyone know how to find the Temporary Items folder, and  create and then
> delete a file there? I am in the need of writing temporary PICT files, and
> then deleting them when done. I want to be sure I am fine across OS
> versions and international too (folder finding/using). Creating just
> involves a Temp name and the vRefnum I imagine, and standard PICT write.

Try FindFolder Toolbox call.
Temporary Items folder signiture is 'temp' (in FB syntax _"temp")
It may be found in Folder.h and constant name will be
"kTemporaryFolderType".

HTH.

Osamu Shigematsu