[Cs-dev] Allocating Memory for Opcodes
Date | 2015-06-02 17:21 |
From | Edward Costello |
Subject | [Cs-dev] Allocating Memory for Opcodes |
Hi, I was wondering about allocating memory for opcodes, should one always use the AuxAlloc function to allocate memory for opcodes? If Calloc and such are used will this possibly block the performance thread? I was wondering also about using csounds circular buffer, will that block performance when that is allocated / de-allocated? Ed ------------------------------------------------------------------------------ _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2015-06-02 17:36 |
From | Michael Gogins |
Subject | Re: [Cs-dev] Allocating Memory for Opcodes |
Attachments | None None |
AuxAlloc memory is freed after Reset, if you use calloc or malloc or C++ new then you are responsible for freeing that memory. The question of glitches in performance I am not so sure about. Regards, Mike ----------------------------------------------------- Michael GoginsIrreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Tue, Jun 2, 2015 at 12:21 PM, Edward Costello <phasereset@gmail.com> wrote: Hi, |
Date | 2015-06-02 17:40 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] Allocating Memory for Opcodes |
You should always AuxAlloc because it is linked to memory management of instruments. If you use something else, memory will leak. ======================== Dr Victor Lazzarini Dean of Arts, Celtic Studies and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 2 Jun 2015, at 17:21, Edward Costello |
Date | 2015-06-02 17:47 |
From | Edward Costello |
Subject | Re: [Cs-dev] Allocating Memory for Opcodes |
Is it not then advisable to use the circular buffer? I looked at it’s code and it seems to use Malloc, I was using it in my web sockets opcode to send data to another thread. Ed > On 2 Jun 2015, at 18:40, Victor Lazzarini |
Date | 2015-06-02 17:49 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] Allocating Memory for Opcodes |
Not only there, but also when replacing instruments with dead instances. ======================== Dr Victor Lazzarini Dean of Arts, Celtic Studies and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 2 Jun 2015, at 17:36, Michael Gogins |
Date | 2015-06-02 18:07 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] Allocating Memory for Opcodes |
Memory should be allocated at init time, in —realtime mode this is done at a separate thread, not interrupting the main thread. In normal mode, it might on occasion block if there is a huge amount to be allocated. In practice it has not been a problem. If you are creating a circular buffer, make sure you implement an opcode dealloc callback to destroy it too. ======================== Dr Victor Lazzarini Dean of Arts, Celtic Studies and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 2 Jun 2015, at 17:47, Edward Costello |