forgot to send to the list...
---------- Forwarded message ---------- From: Mike McGonagle mjmogo@gmail.com Date: Nov 8, 2007 7:00 PM Subject: Re: [PD-dev] Allocating memory in externals To: Charles Henry czhenry@gmail.com
I guess my real issue is that I am using an embedded piece of software which provides its own set of memory functions, so I was just wondering if there are any issues with mixing all these different memory models.
Thanks,
Mike
On 11/8/07, Charles Henry czhenry@gmail.com wrote:
Hi, Mike, There are a few Pd-specific calls, although there is no harm AFAICT (I have used them before, but I am not an expert) with using malloc(), calloc(), or alloca(). In m_pd.h (v. 0.40.2 for example), you will find: /* --------------- memory management -------------------- */ EXTERN void *getbytes(size_t nbytes); EXTERN void *getzbytes(size_t nbytes); EXTERN void *copybytes(void *src, size_t nbytes); EXTERN void freebytes(void *x, size_t nbytes); EXTERN void *resizebytes(void *x, size_t oldsize, size_t newsize);
for the pd-specific memory calls.
Chuck
On Nov 8, 2007 6:27 PM, Mike McGonagle mjmogo@gmail.com wrote:
Hello all,
I was wondering if there are any guidelines to allocating memory in an external? Is there any harm to using malloc/free? Or is there some PD-specific calls that should be used?
Mike M
-- Help the Environment, Plant a Bush back in Texas!
"I place economy among the first and most important republican virtues, and public debt as the greatest of the dangers to be feared. To preserve our independence, we must not let our rulers load us with perpetual debt." -- Thomas Jefferson, third US president, architect and author (1743-1826)
"Give Peace a Chance" -- John Lennon (9 October 1940 – 8 December 1980)
Peace may sound simple—one beautiful word— but it requires everything we have, every quality, every strength, every dream, every high ideal. —Yehudi Menuhin (1916–1999), musician
If you think you can, or you think you can't, you are probably right. —Mark Twain
"Art may imitate life, but life imitates TV." Ani DiFranco
PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
-- Help the Environment, Plant a Bush back in Texas!
"I place economy among the first and most important republican virtues, and public debt as the greatest of the dangers to be feared. To preserve our independence, we must not let our rulers load us with perpetual debt." -- Thomas Jefferson, third US president, architect and author (1743-1826)
"Give Peace a Chance" -- John Lennon (9 October 1940 – 8 December 1980)
Peace may sound simple—one beautiful word— but it requires everything we have, every quality, every strength, every dream, every high ideal. —Yehudi Menuhin (1916–1999), musician
If you think you can, or you think you can't, you are probably right. —Mark Twain
"Art may imitate life, but life imitates TV." Ani DiFranco
Sounds interesting. You probably want to read m_memory.c to see how freebytes, copybytes, and the rest work. See it here: http://pure-data.cvs.sourceforge.net/pure-data/pd/src/m_memory.c?view=log
Chuck
On Nov 8, 2007 7:01 PM, Mike McGonagle mjmogo@gmail.com wrote:
forgot to send to the list...
---------- Forwarded message ---------- From: Mike McGonagle mjmogo@gmail.com Date: Nov 8, 2007 7:00 PM Subject: Re: [PD-dev] Allocating memory in externals To: Charles Henry czhenry@gmail.com
I guess my real issue is that I am using an embedded piece of software which provides its own set of memory functions, so I was just wondering if there are any issues with mixing all these different memory models.
Thanks,
Mike
On 11/8/07, Charles Henry czhenry@gmail.com wrote:
Hi, Mike, There are a few Pd-specific calls, although there is no harm AFAICT (I have used them before, but I am not an expert) with using malloc(), calloc(), or alloca(). In m_pd.h (v. 0.40.2 for example), you will find: /* --------------- memory management -------------------- */ EXTERN void *getbytes(size_t nbytes); EXTERN void *getzbytes(size_t nbytes); EXTERN void *copybytes(void *src, size_t nbytes); EXTERN void freebytes(void *x, size_t nbytes); EXTERN void *resizebytes(void *x, size_t oldsize, size_t newsize);
for the pd-specific memory calls.
Chuck
On Nov 8, 2007 6:27 PM, Mike McGonagle mjmogo@gmail.com wrote:
Hello all,
I was wondering if there are any guidelines to allocating memory in an external? Is there any harm to using malloc/free? Or is there some PD-specific calls that should be used?
Mike M
-- Help the Environment, Plant a Bush back in Texas!
"I place economy among the first and most important republican virtues, and public debt as the greatest of the dangers to be feared. To preserve our independence, we must not let our rulers load us with perpetual debt." -- Thomas Jefferson, third US president, architect and author (1743-1826)
"Give Peace a Chance" -- John Lennon (9 October 1940 – 8 December 1980)
Peace may sound simple—one beautiful word— but it requires everything we have, every quality, every strength, every dream, every high ideal. —Yehudi Menuhin (1916–1999), musician
If you think you can, or you think you can't, you are probably right. —Mark Twain
"Art may imitate life, but life imitates TV." Ani DiFranco
PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
-- Help the Environment, Plant a Bush back in Texas!
"I place economy among the first and most important republican virtues, and public debt as the greatest of the dangers to be feared. To preserve our independence, we must not let our rulers load us with perpetual debt." -- Thomas Jefferson, third US president, architect and author (1743-1826)
"Give Peace a Chance" -- John Lennon (9 October 1940 – 8 December 1980)
Peace may sound simple—one beautiful word— but it requires everything we have, every quality, every strength, every dream, every high ideal. —Yehudi Menuhin (1916–1999), musician
If you think you can, or you think you can't, you are probably right. —Mark Twain
"Art may imitate life, but life imitates TV." Ani DiFranco
--
Help the Environment, Plant a Bush back in Texas!
"I place economy among the first and most important republican virtues, and public debt as the greatest of the dangers to be feared. To preserve our independence, we must not let our rulers load us with perpetual debt." -- Thomas Jefferson, third US president, architect and author (1743-1826)
"Give Peace a Chance" -- John Lennon (9 October 1940 – 8 December 1980)
Peace may sound simple—one beautiful word— but it requires everything we have, every quality, every strength, every dream, every high ideal. —Yehudi Menuhin (1916–1999), musician
If you think you can, or you think you can't, you are probably right. —Mark Twain
"Art may imitate life, but life imitates TV." Ani DiFranco
PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev