implement ring buffer init and cleanup routine