Just wanted some opinions on how bad a practice this is!
I have written a media player which uses a DLL to decode audio files. The DLL opens an MP3 file for example, and sends back decoded raw audio, usually in chunks of 4608 bytes (~20ms), but could be a different size. I need to buffer this audio data for around 5 seconds (1 MB). Rather than writing a complicated circular buffer which feeds in one end and is taken from the other, I decided to simply allocate memory for each new chunk and store a link from one memory location to the next. The oldest buffer is read and memory released. So there is roughly 1 new memory space being allocated and 1 being destroyed every 20ms or so, with around 200 chunks being stored at any one time. I'm using D7 with the FastMM4 memory manager. It is working very well with very little CPU usage at all, which I was surprised at. I've always been under the impression that allocating memory is a slow process. Thoughts?
_______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: delphi@delphi.org.nz Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: unsubscribe