Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Serious memory problem in 3.08.1 on all VST - even stock!

For general discussion related FlowStone

Re: Serious memory problem in 3.08.1 on all VST - even stock

Postby MyCo » Sat Jul 22, 2017 4:19 pm

The negative number turns of the Ruby Timeout changes that Malc added in 3.0.8
If this works, I have at least an idea where the problem is located. Problem is, on my system I only see a minor Memory creeping, it takes several minutes to increase by 1 MB, so don't expect a fix any time soon...because on any code change I've to run FLS for several minutes :mrgreen:
User avatar
MyCo
 
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany

Re: Serious memory problem in 3.08.1 on all VST - even stock

Postby tulamide » Sun Jul 23, 2017 12:12 am

MyCo, you are are fantastic detective! I would have given you a bro-fist, but unfortunately the image size restriction doesn't allow for the typical meme size to show up :mrgreen:

Since this issue is critical also for 3.0.9, I appreciate all the time you need to hunt down the cause!
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Serious memory problem in 3.08.1 on all VST - even stock

Postby MyCo » Mon Jul 24, 2017 10:14 pm

Well after a lot of digging and trying to find a solution, I'm running out of ideas now. The bug is actually a very old Ruby bug: https://bugs.ruby-lang.org/issues/11174

Looks like whenever you use Threads in Ruby, Ruby doesn't bother to cleanup... and its developers don't give a fuck either. This bug report is 2 years old and still open.

FS uses Ruby Threads since 3.0.8 to limit the execution time of RubyEdit method calls... eg. the "event" method gets actually called like this:
Code: Select all
x = Thread.new {
   send("event",data)
}
x.priority = 100
x.kill unless x.join(timeout)


I've already tried like 10 workarounds for this but none work properly. Only way we could avoid it, would be to only have one thread and re-use it... haven't found a way to do it yet
User avatar
MyCo
 
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany

Re: Serious memory problem in 3.08.1 on all VST - even stock

Postby Spogg » Mon Jul 24, 2017 11:30 pm

As a Ruby-ignorant person I have to ask does this really matter if we can just type in -8000 and get the result we want?

I'm sure this is too simplistic an approach but maybe not...?

Cheers

Spogg
User avatar
Spogg
 
Posts: 3358
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England

Re: Serious memory problem in 3.08.1 on all VST - even stock

Postby Walter Sommerfeld » Tue Jul 25, 2017 6:33 pm

btw:
There is a neat 'little' side effect with the minus sign...

my monster project used 12 % CPU max on a Quad Core i7-3770 16GB Ram; Win10 :(
now it uses 6%... :D
User avatar
Walter Sommerfeld
 
Posts: 249
Joined: Wed Jul 14, 2010 6:00 pm
Location: HH - Made in Germany

Re: Serious memory problem in 3.08.1 on all VST - even stock

Postby MyCo » Wed Jul 26, 2017 3:29 pm

Spogg wrote:As a Ruby-ignorant person I have to ask does this really matter if we can just type in -8000 and get the result we want?


You don't want to have the new timeout system turned off when developing in Ruby. eg. if you type in "sleep" in a ruby edit, the whole Ruby interpreter will shut off (on all modules) and you cannot turn it back on again. You'll have to restart FS. The new timeout system will only shut down the Thread that timed out and therefor only the ruby edit in which the issue occured.

I haven't found a solution for the memory leak issue, yet. However I've a workaround that actually has the benefit that Walter mentions. I'll release it with the next alpha version for testing. Basically it'll use the new timeout system in FS, but in EXE/VST exports it'll use the old timeout system. So you can develop safely in FS, and your exports will actually run faster (and also avoid the memory leak unless you use Threads on your own)
User avatar
MyCo
 
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany

Re: Serious memory problem in 3.08.1 on all VST - even stock

Postby Walter Sommerfeld » Wed Jul 26, 2017 7:49 pm

Perfect Idea - i second that solution :)
User avatar
Walter Sommerfeld
 
Posts: 249
Joined: Wed Jul 14, 2010 6:00 pm
Location: HH - Made in Germany

Re: Serious memory problem in 3.08.1 on all VST - even stock

Postby Spogg » Thu Jul 27, 2017 6:49 am

Sounds like a good plan MyCo.

Stepping back a bit, since the bug is embedded in the more recent Ruby interpreter there are 2 options: one is for the ruby devs to fix it (seems unlikely from what you say) and the other is to work around the issue with the solution you suggest. The latter path is obviously the way to go!

Cheers

Spogg
User avatar
Spogg
 
Posts: 3358
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England

Re: Serious memory problem in 3.08.1 on all VST - even stock

Postby FlowStoner » Wed Aug 02, 2017 8:12 am

MyCo wrote:Well after a lot of digging and trying to find a solution, I'm running out of ideas now. The bug is actually a very old Ruby bug: https://bugs.ruby-lang.org/issues/11174

Looks like whenever you use Threads in Ruby, Ruby doesn't bother to cleanup... and its developers don't give a fuck either. This bug report is 2 years old and still open.

FS uses Ruby Threads since 3.0.8 to limit the execution time of RubyEdit method calls... eg. the "event" method gets actually called like this:
Code: Select all
x = Thread.new {
   send("event",data)
}
x.priority = 100
x.kill unless x.join(timeout)


I've already tried like 10 workarounds for this but none work properly. Only way we could avoid it, would be to only have one thread and re-use it... haven't found a way to do it yet


This explains many things about why Ruby in FS is so inefficient ....
Using thread in Ruby is not very efficient, always prefer to use Fiber.
In addition ruby in windows uses win32api CreateThread,
It has a well-known memory leak of 80Byte for every call.
I think replacing the system from Thread, with Fiber
should not only solve the problem,
but also improve the efficiency of the entire Ruby system in FS.

;)
FlowStoner
 
Posts: 24
Joined: Tue Aug 01, 2017 2:03 pm

Re: Serious memory problem in 3.08.1 on all VST - even stock

Postby MyCo » Sat Aug 05, 2017 5:39 pm

Fiber wouldn't work either, the important part is:
Code: Select all
x.join(timeout)


this basically gives the code a maximum runtime, and is the only reason why threads are used in the first place.
User avatar
MyCo
 
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany

PreviousNext

Return to General

Who is online

Users browsing this forum: No registered users and 68 guests