Re: try/catch in scsynth

nathan-PB1wun9k+p9Wk0Htik3J/[email protected]
Newsgroups gmane.comp.audio.supercollider.devel
Message-ID <[email protected]>
On 2018-03-29 15:25, [email protected] wrote:
> If there's no try/catch, then failure to allocate memory in any
> plug-in means the server would crash abruptly, without any sort of
> informative message to the user. It's not really optional here. (It's
> not necessary for plug-in code to throw exceptions intentionally for
> try/catch to be meaningful. And plug-ins I think should pretty
> obviously avoid using exceptions for routine flow-of-control.)
> 
> I guess, if try/catch were bad for performance in the absence of any
> exceptions, we would have heard many many complaints by now. And, if
> you do have exceptions (e.g. out of memory), you have bigger problems
> than an audio dropout.

i'm aware of what this try/catch is protecting from -- my question was 
whether it's the safest way to handle this. i think you're right that 
there isn't a performance problem with try/catch unless something goes 
wrong, in which case the slight risk of an xrun is the least of your 
worries.

scott carver explained to me on slack that there is a more subtle 
problem here. i think that we might be throwing C++ exceptions across 
plain C binary boundaries (twice), which is undefined behavior. i am not 
sure in this case because the throw and try/catch are both in scsynth, 
but it's happening through the plugin shared library. see tim's comment 
in 
https://github.com/supercollider/supercollider/pull/2483#discussion_r87257083


nathan

_______________________________________________
sc-dev mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-dev/
search: http://www.listarc.bham.ac.uk/lists/sc-dev/search/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.