ArrayArrayArrayArrayArrayArrayArrayArray BrainModular BrainModular Users Forum 2015-06-10T01:22:52+02:00 https://brainmodular.org/forums/app.php/feed/topic/4972 2015-06-10T01:22:52+02:00 2015-06-10T01:22:52+02:00 https://brainmodular.org/forums/viewtopic.php?t=4972&p=33067#p33067 <![CDATA[Ram increase pb probably due to "new" operator]]> Statistics: Posted by 23fx23 — 10 Jun 2015, 01:22


]]>
2015-06-09T23:25:21+02:00 2015-06-09T23:25:21+02:00 https://brainmodular.org/forums/viewtopic.php?t=4972&p=33066#p33066 <![CDATA[Ram increase pb probably due to "new" operator]]>

Statistics: Posted by caco — 09 Jun 2015, 23:25


]]>
2015-06-09T19:07:14+02:00 2015-06-09T19:07:14+02:00 https://brainmodular.org/forums/viewtopic.php?t=4972&p=33065#p33065 <![CDATA[Ram increase pb probably due to "new" operator]]>
for now i could get it working via having a fixed sized single array defined at start with headroom i modify in functions, but dynamic sizes create/delete would be nice,
this seems to be the feature for not too much pain will test.. find it a bit strange/hard in c++ to pass arrays from/to functions, the pointer stuff, ram ect arf..still learning

Statistics: Posted by 23fx23 — 09 Jun 2015, 19:07


]]>
2015-06-09T16:44:43+02:00 2015-06-09T16:44:43+02:00 https://brainmodular.org/forums/viewtopic.php?t=4972&p=33064#p33064 <![CDATA[Ram increase pb probably due to "new" operator]]> Statistics: Posted by caco — 09 Jun 2015, 16:44


]]>
2015-06-09T09:57:09+02:00 2015-06-09T09:57:09+02:00 https://brainmodular.org/forums/viewtopic.php?t=4972&p=33062#p33062 <![CDATA[Ram increase pb probably due to "new" operator]]> Statistics: Posted by 23fx23 — 09 Jun 2015, 09:57


]]>
2015-06-09T09:34:34+02:00 2015-06-09T09:34:34+02:00 https://brainmodular.org/forums/viewtopic.php?t=4972&p=33061#p33061 <![CDATA[Ram increase pb probably due to "new" operator]]> new construct yet you are not deleting it correctly afterwards. Hint, once a return statement is reached no other code in the function will get processed so you are not triggering the delete statements to free up the ram.

Statistics: Posted by caco — 09 Jun 2015, 09:34


]]>
2015-06-09T03:10:00+02:00 2015-06-09T03:10:00+02:00 https://brainmodular.org/forums/viewtopic.php?t=4972&p=33060#p33060 <![CDATA[Ram increase pb probably due to "new" operator]]>
Two options, I think...

1) Dont use new:
http://stackoverflow.com/questions/8839 ... mory-leaks

2) Find a way to significantly reduce the # of times it's called, such as a one time allocation.

Statistics: Posted by shawnb — 09 Jun 2015, 03:10


]]>
2015-06-09T01:44:21+02:00 2015-06-09T01:44:21+02:00 https://brainmodular.org/forums/viewtopic.php?t=4972&p=33059#p33059 <![CDATA[Ram increase pb probably due to "new" operator]]>
it's in a synth code ,in some part od the code it looks like each time a new buffer is created it adds to memory with no release, until reaching limits and crash.
i tried to use 'delete' operator both with [] or not , but it doesn't semm to do something :( .a bit stucked from a while.. any ideas?

the code is very wide but it seems this isolated part seemms to be the problem:
(to summup it's an up-scaling array function to process on lows sizes array in order trying to save some cpu then re-stretch.

CODE:

//////        .....double* S1_HI  = new double&#91;SMP_DUR_LOW * reduxa&#93;;        .....        S1_HI = UPSCALE_16X&#40;S1_LOW, SMP_DUR_LOW&#41;;          //   <---------- memory increase stops when bypassing       ......      delete&#91;&#93; S1_HI;S1_HI = nullptr;           // this calls those functions&#58;//////////////////////////////////////////////////////double* BEZIER_MULTI&#58;&#58;UPSCALE_2X&#40;double *Input,int sizein&#41;&#123;int sizeOut = sizein * 2;double* TMP_OUT = new double&#91;sizeOut&#93;;double valin;int j;for &#40;int i = 0; i < sizein; i++&#41;&#123;j = i * 2;valin = Input&#91;i&#93;;TMP_OUT&#91;j&#93; = valin;if &#40;i < &#40;sizein-1 &#41;&#41;&#123;TMP_OUT&#91;j + 1&#93; = &#40;valin + Input&#91;i+1&#93;&#41; / 2;&#125;else&#123;TMP_OUT&#91;j + 1&#93; = valin +&#40;&#40;valin - Input&#91;i - 1&#93;&#41; / 2&#41;;&#125;&#125;return TMP_OUT;delete TMP_OUT;TMP_OUT = nullptr;&#125;//////////////////////////////////////////////////////////////double* BEZIER_MULTI&#58;&#58;UPSCALE_4X&#40;double *Input, int sizein&#41;&#123;int sizeOut = sizein * 4;double* TMPb_OUT = new double&#91;sizeOut&#93;;TMPb_OUT = UPSCALE_2X&#40;UPSCALE_2X&#40;Input, sizein&#41;,sizein*2&#41;;return TMPb_OUT;delete TMPb_OUT;TMPb_OUT = nullptr;&#125;/////////////////////////////////////////////////////////////////double* BEZIER_MULTI&#58;&#58;UPSCALE_8X&#40;double *Input, int sizein&#41;&#123;int sizeOut = sizein * 8;double* TMPc_OUT = new double&#91;sizeOut&#93;;TMPc_OUT = UPSCALE_4X&#40;UPSCALE_2X&#40;Input, sizein&#41;, sizein * 2&#41;;return TMPc_OUT;delete TMPc_OUT;TMPc_OUT = nullptr;&#125;//////////////////////////////////////////////////////////////////double* BEZIER_MULTI&#58;&#58;UPSCALE_16X&#40;double *Input, int sizein&#41;&#123;int sizeOut = sizein * 16;double* TMPd_OUT = new double&#91;sizeOut&#93;;TMPd_OUT = UPSCALE_4X&#40;UPSCALE_4X&#40;Input, sizein&#41;, sizein * 4&#41;;return TMPd_OUT;delete TMPd_OUT;TMPd_OUT = nullptr;&#125;////////////////////////////////////////////////////////

Statistics: Posted by 23fx23 — 09 Jun 2015, 01:44


]]>
BrainModular BrainModular Users Forum 2015-06-10T01:22:52+02:00 https://brainmodular.org/forums/app.php/feed/topic/4972 2015-06-10T01:22:52+02:00 2015-06-10T01:22:52+02:00 https://brainmodular.org/forums/viewtopic.php?t=4972&p=33067#p33067 <![CDATA[Ram increase pb probably due to "new" operator]]> Statistics: Posted by 23fx23 — 10 Jun 2015, 01:22


]]>
2015-06-09T23:25:21+02:00 2015-06-09T23:25:21+02:00 https://brainmodular.org/forums/viewtopic.php?t=4972&p=33066#p33066 <![CDATA[Ram increase pb probably due to "new" operator]]>

Statistics: Posted by caco — 09 Jun 2015, 23:25


]]>
2015-06-09T19:07:14+02:00 2015-06-09T19:07:14+02:00 https://brainmodular.org/forums/viewtopic.php?t=4972&p=33065#p33065 <![CDATA[Ram increase pb probably due to "new" operator]]>
for now i could get it working via having a fixed sized single array defined at start with headroom i modify in functions, but dynamic sizes create/delete would be nice,
this seems to be the feature for not too much pain will test.. find it a bit strange/hard in c++ to pass arrays from/to functions, the pointer stuff, ram ect arf..still learning

Statistics: Posted by 23fx23 — 09 Jun 2015, 19:07


]]>
2015-06-09T16:44:43+02:00 2015-06-09T16:44:43+02:00 https://brainmodular.org/forums/viewtopic.php?t=4972&p=33064#p33064 <![CDATA[Ram increase pb probably due to "new" operator]]> Statistics: Posted by caco — 09 Jun 2015, 16:44


]]>
2015-06-09T09:57:09+02:00 2015-06-09T09:57:09+02:00 https://brainmodular.org/forums/viewtopic.php?t=4972&p=33062#p33062 <![CDATA[Ram increase pb probably due to "new" operator]]> Statistics: Posted by 23fx23 — 09 Jun 2015, 09:57


]]>
2015-06-09T09:34:34+02:00 2015-06-09T09:34:34+02:00 https://brainmodular.org/forums/viewtopic.php?t=4972&p=33061#p33061 <![CDATA[Ram increase pb probably due to "new" operator]]> new construct yet you are not deleting it correctly afterwards. Hint, once a return statement is reached no other code in the function will get processed so you are not triggering the delete statements to free up the ram.

Statistics: Posted by caco — 09 Jun 2015, 09:34


]]>
2015-06-09T03:10:00+02:00 2015-06-09T03:10:00+02:00 https://brainmodular.org/forums/viewtopic.php?t=4972&p=33060#p33060 <![CDATA[Ram increase pb probably due to "new" operator]]>
Two options, I think...

1) Dont use new:
http://stackoverflow.com/questions/8839 ... mory-leaks

2) Find a way to significantly reduce the # of times it's called, such as a one time allocation.

Statistics: Posted by shawnb — 09 Jun 2015, 03:10


]]>
2015-06-09T01:44:21+02:00 2015-06-09T01:44:21+02:00 https://brainmodular.org/forums/viewtopic.php?t=4972&p=33059#p33059 <![CDATA[Ram increase pb probably due to "new" operator]]>
it's in a synth code ,in some part od the code it looks like each time a new buffer is created it adds to memory with no release, until reaching limits and crash.
i tried to use 'delete' operator both with [] or not , but it doesn't semm to do something :( .a bit stucked from a while.. any ideas?

the code is very wide but it seems this isolated part seemms to be the problem:
(to summup it's an up-scaling array function to process on lows sizes array in order trying to save some cpu then re-stretch.

CODE:

//////        .....double* S1_HI  = new double&#91;SMP_DUR_LOW * reduxa&#93;;        .....        S1_HI = UPSCALE_16X&#40;S1_LOW, SMP_DUR_LOW&#41;;          //   <---------- memory increase stops when bypassing       ......      delete&#91;&#93; S1_HI;S1_HI = nullptr;           // this calls those functions&#58;//////////////////////////////////////////////////////double* BEZIER_MULTI&#58;&#58;UPSCALE_2X&#40;double *Input,int sizein&#41;&#123;int sizeOut = sizein * 2;double* TMP_OUT = new double&#91;sizeOut&#93;;double valin;int j;for &#40;int i = 0; i < sizein; i++&#41;&#123;j = i * 2;valin = Input&#91;i&#93;;TMP_OUT&#91;j&#93; = valin;if &#40;i < &#40;sizein-1 &#41;&#41;&#123;TMP_OUT&#91;j + 1&#93; = &#40;valin + Input&#91;i+1&#93;&#41; / 2;&#125;else&#123;TMP_OUT&#91;j + 1&#93; = valin +&#40;&#40;valin - Input&#91;i - 1&#93;&#41; / 2&#41;;&#125;&#125;return TMP_OUT;delete TMP_OUT;TMP_OUT = nullptr;&#125;//////////////////////////////////////////////////////////////double* BEZIER_MULTI&#58;&#58;UPSCALE_4X&#40;double *Input, int sizein&#41;&#123;int sizeOut = sizein * 4;double* TMPb_OUT = new double&#91;sizeOut&#93;;TMPb_OUT = UPSCALE_2X&#40;UPSCALE_2X&#40;Input, sizein&#41;,sizein*2&#41;;return TMPb_OUT;delete TMPb_OUT;TMPb_OUT = nullptr;&#125;/////////////////////////////////////////////////////////////////double* BEZIER_MULTI&#58;&#58;UPSCALE_8X&#40;double *Input, int sizein&#41;&#123;int sizeOut = sizein * 8;double* TMPc_OUT = new double&#91;sizeOut&#93;;TMPc_OUT = UPSCALE_4X&#40;UPSCALE_2X&#40;Input, sizein&#41;, sizein * 2&#41;;return TMPc_OUT;delete TMPc_OUT;TMPc_OUT = nullptr;&#125;//////////////////////////////////////////////////////////////////double* BEZIER_MULTI&#58;&#58;UPSCALE_16X&#40;double *Input, int sizein&#41;&#123;int sizeOut = sizein * 16;double* TMPd_OUT = new double&#91;sizeOut&#93;;TMPd_OUT = UPSCALE_4X&#40;UPSCALE_4X&#40;Input, sizein&#41;, sizein * 4&#41;;return TMPd_OUT;delete TMPd_OUT;TMPd_OUT = nullptr;&#125;////////////////////////////////////////////////////////

Statistics: Posted by 23fx23 — 09 Jun 2015, 01:44


]]>