Csound Csound-dev Csound-tekno Search About

[Cs-dev] Allocating Memory for Opcodes

Date2015-06-02 17:21
FromEdward 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

Date2015-06-02 17:36
FromMichael Gogins
SubjectRe: [Cs-dev] Allocating Memory for Opcodes
AttachmentsNone  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 Gogins
Irreducible 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,

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
https://lists.sourceforge.net/lists/listinfo/csound-devel


Date2015-06-02 17:40
FromVictor Lazzarini
SubjectRe: [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  wrote:
> 
> 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
> https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2015-06-02 17:47
FromEdward Costello
SubjectRe: [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  wrote:
> 
> 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  wrote:
>> 
>> 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
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/

Date2015-06-02 17:49
FromVictor Lazzarini
SubjectRe: [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  wrote:
> 
> 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 Gogins
> Irreducible Productions
> http://michaelgogins.tumblr.com
> Michael dot Gogins at gmail dot com
> 
> On Tue, Jun 2, 2015 at 12:21 PM, Edward Costello  wrote:
> 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
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2015-06-02 18:07
FromVictor Lazzarini
SubjectRe: [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  wrote:
> 
> 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  wrote:
>> 
>> 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  wrote:
>>> 
>>> 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
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>> 
>> 
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.source