Zeus Productions Banner

Home (Spotlight) | TOC | Products & Ordering | Technical Info | Contact Zeus

Zeus Tech Note
Memory Leaks

(This document last revised July 8, 1997)

Copyright © 1996-1997. Zeus Productions. All Rights Reserved.
Written by Bruce A. Epstein

Q. What is a memory leak?

A. A memory leak occurs when a program, DLL, Xtra or XObject allocates memory without releasing it at a later time. The system thinks that the memory is in use, but it is not deallocated properly. This causes the allocated RAM to be lost from the pool of available RAM. Even if a memory leak is small (a few dozen bytes), the cumulative affect over thousands of iterations can lead to a crash if Director runs out of memory.

Q. How do I detect a memory leak?

A. You can used the Lingo "the freebytes" to display the amount of memory available to Director. Under Windows, this amount will fluctuate as the OS allocates memory dynamically to Director. It will also change depending on what Director has loaded into RAM. You can use the "unload" command to clear castmembers from RAM.

You can test your program for leaks by repeatedly performing the operation you suspect of causing the leak, and checking "the freebytes" periodically. For example, to test if a command causes a leak, you might use:
	repeat with x = 1 to 100
	  -- Test it here
	  put "The freeBytes equals" && the freeBytes.
	end repeat

Q. What causes memory leaks?

There are several factors to consider:

Home (Spotlight) | Table of Contents | Links | Contact Info

Place an Order | Products for Sale | Licensing | Downloads

TechNotes | FAQs | E-Mail Zeus | GuestBook | Glossary

[End of Page]

Copyright © 1996-1997. Zeus Productions. All Rights Reserved.