From: Conrad P. <co...@ve...> - 2001-04-27 05:49:24
|
On Thu, Apr 12, 2001 at 04:31:44PM +0200, Radoslaw Korzeniewski wrote: > Hi, > > I've discovered that sweep is alocating more memory than is needed. > Take a look at that functions -> sample_load, sample_new_empty and sounddata_new_empty: > > ----------> sample_load <----------------------------- > (...) > s = sample_new_empty(dn, fn, channelcount, (int)rate, framecount); > > if(!s) return NULL; > /* ok, we have full new structure(s) for sample. All needed memory regions > should be alocated (and most time are) */ > > s->sounddata->data = > g_malloc(frames_to_bytes(s->sounddata->format, framecount)); > > /* but here we are alocating memory for sample data > when this memory is already allocated in sounddata_new_empty > function. This means that for loaded sample double memory is > allocated */ > > if (s->sounddata->data == NULL) { > fprintf(stderr, "s->sounddata->data NULL"); > return NULL; > } > (...) > > I'm working on patch for it now. When it will be ready I'll send it to the > sweep-devel list. Heh, well done. No need to send a patch, you've described it well. I've removed the malloc from sample_load and also the following check of data against NULL as both are redundant. updated in CVS thanks, Conrad. |