[Csnd-dev] Strdup and plugin.h
Date | 2017-04-11 20:57 |
From | Guillermo Senna |
Subject | [Csnd-dev] Strdup and plugin.h |
Hi, I'm looking into the file ftsamplebank.cpp. It uses OpcodeBase.hpp. When copying the filenames into the string array I see it does: strings[i].data = csound->Strdup(csound, file); I'm writing something similar but with plugin.h. I can't access Strdup, do I? What would be the correct way of doing it with plugin.h? Thanks. Cheers. |
Date | 2017-04-11 21:12 |
From | Victor Lazzarini |
Subject | Re: [Csnd-dev] Strdup and plugin.h |
I can add it for you.
Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland
|
Date | 2017-04-11 21:19 |
From | Guillermo Senna |
Subject | Re: [Csnd-dev] Strdup and plugin.h |
If it's not too much trouble that'd be great Victor! On 11/04/17 17:12, Victor Lazzarini wrote: > I can add it for you. > > Victor Lazzarini > Dean of Arts, Celtic Studies, and Philosophy > Maynooth University > Ireland > > On 11 Apr 2017, at 20:56, Guillermo Senna |
Date | 2017-04-11 21:29 |
From | Victor Lazzarini |
Subject | Re: [Csnd-dev] Strdup and plugin.h |
It’s there now: you can use it in an opcode through the csound member: newstr = csound->strdup(s) ======================== Prof. 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 11 Apr 2017, at 21:19, Guillermo Senna |
Date | 2017-04-11 21:52 |
From | Victor Lazzarini |
Subject | Re: [Csnd-dev] Strdup and plugin.h |
You can see the updated reference for this here: http://vlazzarini.github.io/cpof/ ======================== Prof. 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 11 Apr 2017, at 21:29, Victor Lazzarini |
Date | 2017-04-11 21:59 |
From | Guillermo Senna |
Subject | Re: [Csnd-dev] Strdup and plugin.h |
Thanks Victor! Unfortunately I'm still leaking memory. Could it be from csound->strdup or because I git pulled? Valgrind has some "lost records" including strdup but I don't think it's the same strdup. I'll keep testing. ==9926== 20 bytes in 1 blocks are possibly lost in loss record 30 of 194 ==9926== at 0x4C2CB3F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==9926== by 0x5665BF9: strdup (strdup.c:42) ==9926== by 0x10B09F23: ??? (in /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0) ==9926== by 0x10B1FFF7: ??? (in /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0) ==9926== by 0x10B20687: ??? (in /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0) ==9926== by 0x10B22AA6: snd_pcm_open (in /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0) ==9926== by 0x108CC472: ??? ==9926== by 0x108CD4E3: ??? ==9926== by 0x108CD572: ??? ==9926== by 0x4EB6DB7: sfopenout (in /usr/local/lib/libcsound64.so.6.0) ==9926== by 0x4EA410B: musmon (in /usr/local/lib/libcsound64.so.6.0) ==9926== by 0x5016B0A: csoundStart (in /usr/local/lib/libcsound64.so.6.0) On 11/04/17 17:29, Victor Lazzarini wrote: > It’s there now: you can use it in an opcode through the csound member: > > newstr = csound->strdup(s) > ======================== > Prof. 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 11 Apr 2017, at 21:19, Guillermo Senna |
Date | 2017-04-11 22:00 |
From | Guillermo Senna |
Subject | Re: [Csnd-dev] Strdup and plugin.h |
Yeah, today I found the README.md in github. It's of great help. On 11/04/17 17:52, Victor Lazzarini wrote: > You can see the updated reference for this here: > http://vlazzarini.github.io/cpof/ > ======================== > Prof. 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 11 Apr 2017, at 21:29, Victor Lazzarini |
Date | 2017-04-11 22:03 |
From | Guillermo Senna |
Subject | Re: [Csnd-dev] Strdup and plugin.h |
So, Csound is leaking memory according to valgrind. The following instrument is showing 104 records definitely lost: instr 1 print 42 endin On 11/04/17 17:29, Victor Lazzarini wrote: > It’s there now: you can use it in an opcode through the csound member: > > newstr = csound->strdup(s) > ======================== > Prof. 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 11 Apr 2017, at 21:19, Guillermo Senna |
Date | 2017-04-11 22:05 |
From | Victor Lazzarini |
Subject | Re: [Csnd-dev] Strdup and plugin.h |
I don’t know. The strdup is the same as in the other opcode you pointed out. ======================== Prof. 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 11 Apr 2017, at 21:59, Guillermo Senna |
Date | 2017-04-11 23:04 |
From | Victor Lazzarini |
Subject | Re: [Csnd-dev] Strdup and plugin.h |
It might not be in Csound. It could be in the alsa library or somewhere else. In your previous example, valgrind was pointing to libasound: ==9926== 20 bytes in 1 blocks are possibly lost in loss record 30 of 194 ==9926== at 0x4C2CB3F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==9926== by 0x5665BF9: strdup (strdup.c:42) ==9926== by 0x10B09F23: ??? (in /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0) ==9926== by 0x10B1FFF7: ??? (in /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0) ==9926== by 0x10B20687: ??? (in /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0) ==9926== by 0x10B22AA6: snd_pcm_open (in /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0) ======================== Prof. 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 11 Apr 2017, at 22:03, Guillermo Senna |
Date | 2017-04-11 23:24 |
From | Guillermo Senna |
Subject | Re: [Csnd-dev] Strdup and plugin.h |
Yes, every lost record mentions libasound. It wasn't there yesterday while I was trying to access Strdup so it might be the Ubuntu update this morning (if you think it wasn't the git pull from the Csound repo). Btw, csound->strdup works great for me. Thanks again! On 11/04/17 19:04, Victor Lazzarini wrote: > It might not be in Csound. It could be in the alsa library or somewhere else. In your previous example, > valgrind was pointing to libasound: > > ==9926== 20 bytes in 1 blocks are possibly lost in loss record 30 of 194 > ==9926== at 0x4C2CB3F: malloc (in > /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) > ==9926== by 0x5665BF9: strdup (strdup.c:42) > ==9926== by 0x10B09F23: ??? (in > /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0) > ==9926== by 0x10B1FFF7: ??? (in > /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0) > ==9926== by 0x10B20687: ??? (in > /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0) > ==9926== by 0x10B22AA6: snd_pcm_open (in > /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0) > > ======================== > Prof. 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 11 Apr 2017, at 22:03, Guillermo Senna |
Date | 2017-04-11 23:36 |
From | Victor Lazzarini |
Subject | Re: [Csnd-dev] Strdup and plugin.h |
No, I don’t think we changed anything in memory allocation lately. ======================== Prof. 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 11 Apr 2017, at 23:24, Guillermo Senna |