Hijacking thread - is there any discussion about soft references? Soft
referenced objects can be garbage-collected if engine "decide that memory
is low enough to warrant it".

On Fri, Apr 17, 2020 at 10:35 PM Gus Caplan <[email protected]> wrote:

> Check this out:
> https://github.com/tc39/proposal-explicit-resource-management
>
> On Fri, Apr 17, 2020 at 2:44 PM Ben Manashirov <[email protected]> wrote:
>
>> Hello,
>>
>> It's easy to leak data in javascript because you need to call free(), or
>> destroy() for various objects, for example when interfacing with OpenGL,
>> emscripten, or some other object that needs to do cleanup beyond what a
>> garbage collector can handle. I really want guaranteed destructors in
>> javascript, it will make my life so much easier. I don't want anything
>> similar to try-release that is introduced to Java because that doesn't
>> solve the problem, it just moves the problem of having to call free/destroy
>> to having to remember to list it in a try-release statement. Perhaps add a
>> destructor() or destroy() as many libraries use destroy(). and if one
>> exists treat the object with care to have it destroyed as soon as it's no
>> longer referenced. Doing it for destroy() may break existing code so a
>> another name would probably be better that people can migrate to, perhaps a
>> special keyword in class{} interface 'destructor', and if one exists then
>> special care will be given and a autogenerated 'destroy()' function is
>> automatically created that a person can call to do destruction if they
>> desire to do so earlier than when no more references are pointing to it.
>>
>> I hope this discussion will lead to some solution.
>>
>> Thank you.
>> _______________________________________________
>> es-discuss mailing list
>> [email protected]
>> https://mail.mozilla.org/listinfo/es-discuss
>>
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to