I need to set the content to 0 because actually is not using malloc(), it uses calloc() that does set the memory to 0. Best Regards --------------------------------------------- Helios Cuevas L?pez Embedded Software Engineer Castle Care-tech Ltd. First Floor, 6 Bracknell Beeches, Old Bracknell Lane West, Bracknell, Berkshire, RG12 7BW Office - 01344 469470 Direct Dial - 01344 469485 FAX - 01344 469489 http://www.castle-caretech.com<http://www.castle-caretech.com/> http://www.pyronix.com/ This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error, please destroy this message and kindly notify the sender by reply e-mail P please don't print this e-mail unless you really need to. From: Yanick Bourbeau [mailto:ybourbeau at mrgtech.ca] Sent: 22 May 2013 13:42 To: Helios Lopez Subject: Re: [Speex-dev] Library without malloc It looks fine to me. I guess you don't even need to set content to 0. I don't think malloc do it anyway. You could use bzero() instead of your for loop. bzero(&frame, N * 2); http://linux.die.net/man/3/bzero On 13-05-22 04:38 AM, Helios Lopez wrote: Yanick & Jean-Marc, First of all thank you very much for taking your time to try to help me. Hi Yanick, This is what I am trying to do, but for example the function SpeexPreprocessState *speex_preprocess_state_init has lots of pointers that are initialize with static inline void *speex_alloc (int size). So I am trying to convert all this pointers into arrays but it is getting messy trying to found out how big they need to be, and not sure if it will work. And it is not only the struct SpeexPreprocessState_ that has lots of pointers there are other structures with pointers too. So I am trying to replace this pointers with arrays. This is what I am doing but not sure if it is correct: spx_word16_t *frame; converted to: spx_word16_t frame[2*N]; st-> frame = (spx_word16_t *)speex_alloc(2*N*sizeof(spx_word16_t)); converted to: for(i=0;i<(2*N);i++) { st->frame[i] = 0; } Hi Jean-Marc I saw the os_support.h file, but what are you suggesting to change the malloc() with, maybe I didn't explain my self very well, my problem is that I cannot use dynamic memory. So everything needs to be define as static with a specific size arrays. Again thank you both for your support. Many thanks, Best Regards --------------------------------------------- Helios Cuevas L?pez Embedded Software Engineer Castle Care-tech Ltd. First Floor, 6 Bracknell Beeches, Old Bracknell Lane West, Bracknell, Berkshire, RG12 7BW Office - 01344 469470 Direct Dial - 01344 469485 FAX - 01344 469489 http://www.castle-caretech.com<http://www.castle-caretech.com/> http://www.pyronix.com/ This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error, please destroy this message and kindly notify the sender by reply e-mail P please don't print this e-mail unless you really need to. From: Yanick Bourbeau [mailto:ybourbeau at mrgtech.ca] Sent: 21 May 2013 17:52 To: Helios Lopez Subject: Re: [Speex-dev] Library without malloc You don't need malloc at all. Just create a byte array like: unsigned char buffer[160]; And use &buffer[0] as pointer in speex functions? On 13-05-21 12:17 PM, Helios Lopez wrote: Dear all, I am trying to use the Speex library pre-processor, I only need the VAD and Echo Canceller. I am using a STM32F103 processor, but I am using a tiny OS and it doesn't allow to use malloc. Is there a version of the library that will work without the need of using malloc? Obviously I will use all the time the same parameters, like 8kHz sampling rate, 160 frame... I will appreciate any help or idea that you could give me. Many thanks, Best Regards --------------------------------------------- Helios Cuevas L?pez Embedded Software Engineer Castle Care-tech Ltd. First Floor, 6 Bracknell Beeches, Old Bracknell Lane West, Bracknell, Berkshire, RG12 7BW Office - 01344 469470 Direct Dial - 01344 469485 FAX - 01344 469489 http://www.castle-caretech.com<http://www.castle-caretech.com/> http://www.pyronix.com/ This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error, please destroy this message and kindly notify the sender by reply e-mail P please don't print this e-mail unless you really need to. ______________________________________________________________________ Castle Care-Tech, First Floor, 6 Bracknell Beeches, Old Bracknell Lane West, Bracknell, Berkshire, RG12 7BW. Telephone 01344 469479 | Fax 01344 469489 | Web www.castle-caretech.com<http://www.castle-caretech.com> Disclaimer: This Email contains confidential and proprietary information some or all of which may be legally privileged. It is for the intended recipient only. If you have received this Email in error, please notify the author immediately by telephone or by replying to this Email. If you are not the intended recipient you must not use, disclose, distribute, copy, print or rely on this Email. Castle is part of the Secure Holdings Group and is Registered in England with Company Number 3218507. Castle, Secure House, Braithwell Way, Hellaby, S. Yorkshire, S66 8QY, England. ______________________________________________________________________ _______________________________________________ Speex-dev mailing list Speex-dev at xiph.org<mailto:Speex-dev at xiph.org> http://lists.xiph.org/mailman/listinfo/speex-dev ______________________________________________________________________ Castle Care-Tech, First Floor, 6 Bracknell Beeches, Old Bracknell Lane West, Bracknell, Berkshire, RG12 7BW. Telephone 01344 469479 | Fax 01344 469489 | Web www.castle-caretech.com<http://www.castle-caretech.com> Disclaimer: This Email contains confidential and proprietary information some or all of which may be legally privileged. It is for the intended recipient only. If you have received this Email in error, please notify the author immediately by telephone or by replying to this Email. If you are not the intended recipient you must not use, disclose, distribute, copy, print or rely on this Email. Castle is part of the Secure Holdings Group and is Registered in England with Company Number 3218507. Castle, Secure House, Braithwell Way, Hellaby, S. Yorkshire, S66 8QY, England. ______________________________________________________________________ ______________________________________________________________________ Castle Care-Tech, First Floor, 6 Bracknell Beeches, Old Bracknell Lane West, Bracknell, Berkshire, RG12 7BW. Telephone 01344 469479 | Fax 01344 469489 | Web www.castle-caretech.com Disclaimer: This Email contains confidential and proprietary information some or all of which may be legally privileged. It is for the intended recipient only. If you have received this Email in error, please notify the author immediately by telephone or by replying to this Email. If you are not the intended recipient you must not use, disclose, distribute, copy, print or rely on this Email. Castle is part of the Secure Holdings Group and is Registered in England with Company Number 3218507. Castle, Secure House, Braithwell Way, Hellaby, S. Yorkshire, S66 8QY, England. ______________________________________________________________________ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/speex-dev/attachments/20130522/bebf110b/attachment-0001.htm