Brief Index      Full Index      I.M. Reference

Show_Memory_Usage


Functions

void Show_Memory_Usage (long *allocated, long *in_use)

Function Documentation

void Show_Memory_Usage ( long *  allocated,
long *  in_use 
)

Tells your program how much memory is being used for graphics data storage.

Parameters:
allocated - The total amount of memory that HOOPS has obtained from the operating system, in bytes. Passed by reference always. Returned to user.
in_use - The portion of the allocated memory, which is currently holding useful information, in bytes. Passed by reference always. Returned to user.

DETAILS

Almost everything in HOOPS involves bits and pieces of memory: setting attributes, storing geometry, editing text, creating segments, and so on.

Under some conditions, such as an exceptionally large program running on a not-exceptionally-large machine, it can be handy to know how much memory HOOPS is using for storing graphics. HOOPS generally allocates memory in large chunks from the operating system, then parcels the chunks out as needed for information to be stored in the database. Allocated indicates the total size of all the chunks; in_use indicates the amount that's currently parcelled out.

The memory usage information is also useful during debugging: you might be able to use it to determine if your program (or perhaps HOOPS) is "leaking" memory, i.e., not cleaning up the segment tree properly after a procedure is finished. This can be important if your application will run for long periods of time at a stretch.

NOTES

Some changes and deletions in the database might cause immediate changes in the memory usage statistics, while others might be delayed until after the next screen Update.

Because of the nature of the HOOPS "fast" memory allocation methods, only a Relinquish_Memory() or Reset_System() can completely clean up the allocated-but-not-in_use memory and return it to the operating system.

In general, it's not possible to determine in advance how much memory the operating system is going to allow your program. An approximation can be made by allocating (via malloc, if you're in C) everything you can and then freeing it all again. Note: Running the memory out to the limit might cause the operating system to thrash on some virtual-memory machines.

As a rule, it's expensive to call Show_Memory_Usage---avoid using it with any frequency in your program.

RESTRICTIONS

See also:
Show_Time, Reset_System, Relinquish_Memory.

Main Index
Brief Index      Full Index      I.M. Functions