Welcome Guest Search | Active Topics | Log In | Register

Memory Leak - please confirm
#1 Posted : Wednesday, October 19, 2016 6:16:29 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 3/1/2016(UTC)
Posts: 5

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)

It appears that there may be a memory leak in the CreateDefaultDelegate routine if the error condition is met.

Please take a look:
Lines: 84-85
Condition: if error condition is met - NULL is returned, but SQTable *t (line 79) and SQNativeClosure *nc (line 81) and SQString nc->_name (line 83) never get deallocated, resulting in leaks.

Could you please confirm whether this assessment is accurate? I am tempted to fix this by releasing the native closure and the table before returning NULL (which will in turn free the string _name), but wanted to confirm that my speculation is correct before taking matters into my own hands.

#2 Posted : Saturday, October 22, 2016 5:34:03 PM(UTC)
Rank: Advanced Member

Groups: Registered, Administrators
Joined: 6/11/2005(UTC)
Posts: 1,062

Thanks: 0 times
Was thanked: 80 time(s) in 62 post(s)
Yes, good catch, that would create a leak. However, that is internal vm code that is extensively tested so is not really ever going to fail( theoretically :D ). I'd say replacing that with an assert() is the best solution, It should never fail as is part of the vm code. anyway we can't recover from that failure.

thank you

Follow me on Twitter @squirrellang
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Clean Slate theme by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.4 | YAF © 2003-2010, Yet Another Forum.NET
This page was generated in 0.106 seconds.