I suspect that what you are seeing is a consequence of the fact that MacPerl does not allocate all of its memory for objects from MacOS Memory Manager calls. Much of what MacPerl allocates comes from a "malloc" library. That memory is requested from the MacOS heap, but I do not believe that it is returned then when it is freed. The memory is retained to fulfill future malloc() calls. Thus, since FreeMem() only knows of the memory that is free in the MacOS memory heap, and is unaware of the free memory in the malloc library, you see precisely the behavior your described. I believe that the malloc() library in use has the ability to release freed malloc memory back into the MacOS heap, but I do not know if this is turned on, and it only releases completely freed malloc memory blocks, which do not always occur. ---------- From: Angus McIntyre Sent: Tuesday, November 26, 1996 2:01 PM To: MacPerl Subject: [MacPerl] Apparent MacPerl 5 memory handling oddities (This is a copy of a message with which I pestered poor Matthias a while back; from his graceful silence, I infer that it would probably be better directed to the list, in the hope that someone with more free time on their hands can provide an answer. Particularly since I suspect that this is related to my misunderstanding of the way Perl works/should work, rather than an actual quirk of MacPerl). My question is about the way MacPerl 5.1.0r2 handles memory. I have a test script that creates an object, assigns a large number of 'instance variables' to that object (which is realised as a simple hash reference), then exits the subroutine in which the object was created, destroying it. The first time I run the script, assignment of the instance variables takes a large chunk of memory (using 'FreeMem' to monitor memory). When the object is destroyed, much of this memory is not recovered. If I re-run the script (without restarting MacPerl) subsequent assignments (to a new object) take very much less memory, and almost all of it is subsequently recovered. Have I failed to understand something fundamental, or is there something strange going on? Is this a quirk of MacPerl, or does Perl always behave like this?