Jump to content

Why don't llGetFreeMemory() and llGetUsedMemory reconcile to 64k?


Life Camino
 Share

You are about to reply to a thread that has been inactive for 3315 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

It seems to me, that adding the used memory to the available memory should result in a total that is 64k (in a mono script).  But, it doesn't.  I have a script that reports 3946 bytes of free memory, but when I substitute the llGetUsedMemory command for the llGetFreeMemory command I get 41674 bytes of memory used.  Why don't these two numbers add up to 64k?

Thanks, for any insight you can offer into this discrepancy.

Link to comment
Share on other sites

I've forgotten a lot and without looking it up, I'd expect issues like heap fragmentation to come into play. It could be that the first is reporting largest contiguous free heap space.

 

Others with more interest will hopefully give more insightful and better qualified answers soon. :)

Link to comment
Share on other sites

In a small test script I get 64k.

I have a few bigger scripts that read notecards and give a status message including free memory after initialization. I enhanced the message so I get free mem, used mem and the added values. Always full 64k.

You should put all checks in one script btw. - compiling 2 different script will not give you exact 64k anyways - but this doesn't explain your big difference of course.

I can only give a theory here:
The heap fragments over time and parts become unusable. If there is no garbage collection the available memory will be less than 64k.
I think I have once read that mono scripts only make a garbage collection when the 64k is exceeded. If the memory consuption is still over 64k after this you will get an error. Can't remember for sure and have no source though, but would make sense since this will cause cpu intense garbage collections only in rare cases.

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3315 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...