Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0008718opensim[REGION] Scripting Enginepublic2020-06-23 20:562020-07-09 18:13
ReporterCnayl Rainbow 
Assigned To 
PlatformOperating SystemOperating System Version
Product Version0.9.1.0 
Target VersionFixed in Version 
Summary0008718: Using return in timer event can cause memory leak
DescriptionOn YEngine, if you create a list in the timer event and then exit the timer event using return statement the memory allocated to the list is not released.

See below for script that demonstrates this.
Steps To Reproduceinteger toggle;

        toggle = FALSE;
    touch_end(integer num)
        toggle = !toggle;
        list userData=llGetObjectDetails(llGetKey(), [OBJECT_NAME,OBJECT_POS, OBJECT_ROT]);
        llOwnerSay("Used mem=" +(string)llGetUsedMemory());
        if (toggle == TRUE) return;

Additional InformationRun above script and memory used stays the same until you touch the object which then toggles the variable to make the timer event quit with a return, then you will see each time the memory used starts to increase. Touch again to toggle back to not leaving timer event with return and memory again stays same.
TagsNo tags attached.
Git Revision or version number
Run Mode Grid (1 Region per Sim)
Physics EngineubODE
Script EngineYEngine
EnvironmentMono / Linux64
Mono Version6.x
Attached Files

- Relationships

-  Notes
tampa (reporter)
2020-06-24 10:40

Can you please paste the output of mono --version from the box you are running on?
Cnayl Rainbow (reporter)
2020-06-24 12:37

Mono JIT compiler version (Debian Wed Feb 26 23:23:50 UTC 2020)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors.
    TLS: __thread
    SIGSEGV: altstack
    Notifications: epoll
    Architecture: amd64
    Disabled: none
    Misc: softdebug
    Interpreter: yes
    LLVM: supported, not enabled.
    Suspend: hybrid
    GC: sgen (concurrent by default)
Cnayl Rainbow (reporter)
2020-06-24 12:39

Also happens on another server that gives this for --version

Mono JIT compiler version 4.6.2 (Debian
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors.
    TLS: __thread
    SIGSEGV: altstack
    Notifications: epoll
    Architecture: amd64
    Disabled: none
    Misc: softdebug
    LLVM: supported, not enabled.
    GC: sgen
tampa (reporter)
2020-06-25 22:20

As I suspected the issue is not the return, well not entirely. The issue is the list. See when you remove that part adding the return does not increase the memory.

Equally if you add

userData = [];

before the return the memory stays the same.

YEngine has some issues with lists, I suspect it is not clearing them properly and since your timer temporarily declares it within its scope and then has to make it part of the return? That part is odd yes, but I suspect the return just makes it more visible. The real issue might be that lists are not part of gc and so accumulate when they are set to be required outside of their scope(by way of return).

Ubit might know more about that.
Cnayl Rainbow (reporter)
2020-06-26 05:49

Okay, I did phrase the bug as 'memory allocated to lists is not released' so what you say at least confirms that, but I would have thought exiting in any way should clear anything declared as local to an event or function?

I know some purists may say jumping out of something using a return without a value is bad practice but this is something in someone else's code ;) It's easy enough (and I have) to rewrite to fix but I do feel this is still a bug?
UbitUmarov (administrator)
2020-06-26 05:54

this not true memory leaks
this are issues on Yengine internal account of that use.
guess return is jumping over some code needed for that
 i will look to this particular one, err one day ;)
UbitUmarov (administrator)
2020-06-27 05:41

Should be better on master now, Thanks
tampa (reporter)
2020-07-09 18:13

Haven't had much time to test this yet, but suspect there might be additional cases that could be related. Lists tend to be bad. Has anyone tested the changes on master?

- Issue History
Date Modified Username Field Change
2020-06-23 20:56 Cnayl Rainbow New Issue
2020-06-23 20:58 Cnayl Rainbow Additional Information Updated View Revisions
2020-06-24 10:40 tampa Note Added: 0036547
2020-06-24 12:37 Cnayl Rainbow Note Added: 0036548
2020-06-24 12:39 Cnayl Rainbow Note Added: 0036549
2020-06-25 22:20 tampa Note Added: 0036550
2020-06-26 05:49 Cnayl Rainbow Note Added: 0036551
2020-06-26 05:54 UbitUmarov Note Added: 0036552
2020-06-27 05:41 UbitUmarov Note Added: 0036553
2020-07-09 18:13 tampa Note Added: 0036588
2020-07-09 18:13 tampa Status new => acknowledged

Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker