Cool finalizer assert trick

I just saw a cool trick done in a finalizer of a class. When a class implements IDisposable then its creator needs to call Dispose when it is finishen. Lots of developers forget this and that usually results in system resources that are locked until the garbage collector thinks its time to do its work.

The code construction I saw was:


I have never thought of doing this but it makes sense to just add a assert to a finalizer to get notified that you didn’t dispose the object. The finalizer will never be called if it would because of the GC.SuppressFinalize(this); statement that should be done when calling IDisposable.Dispose on the object.

It could be that you are getting this in a service and then this doesn’t make any sense but then you could just log an error instead.

DAW: Multiple ASIO devices

I have bought the Samson C03U USB microphone and after plugging it into an available USB port it worked immediately. I then wanted to use it from any of my sequencers (Cubase AI and FLStudio) but only to find out that neither can use multiple ASIO devices simultaneously. Not that difficult to understand as probably only one ASIO device can be active at a time and for that you get low latency audio out/in in return. I also saw an ASIO DirectX Full Duplex driver. Probably a ASIO host that delegates to direct sound. Had not seen that before so I selected it and there I could select the audio devices that I wanted to make available and it worked! I could use my Creative X-FI Extreme Gamer for audio out and my Samson C03U for audio in. The only big problem is that I had lots of latency. After tweaking it I found out that I could lower the buffersize to 512 samples  instead of the default 2048 which decreased the latency but it is still not very enjoyable to listen live to the incoming audio.

I remembered that I had used ASIO4ALL a long time ago when I didn’t had ASIO drivers for my onboard sound. ASIO4ALL is similar to the Directsound ASIO provider in configuration but in ASIO4ALL I could lower the buffer sizes to 64 samples which reduced the latency to acceptable levels to listen to the incoming audio. A few clicks occur in the out so I increased that to 96 samples.

I think that I have lower latency using the ASIO4ALL drivers instead of the drivers from Creative.

No CNAME on a domain record only on subdomains

We were having some mail problems. This is not always the case but we now found the culprit. The problem was that our domain record *had* a CNAME record referring to the A record of the webserver. Some mail servers will use the CNAME record instead of the MX record when the smtp server needs to be resolved. A CNAME CNAME

This will result in lots of mail servers not being able to deliver the mail. So today’s (DNS) lessons learned are:

  1. Do not set a CNAME record on your domain
  2. Do not use a CNAME record for a catch all (* as this too suffers from the same problems.

You can still use CNAME records for your ‘service’ subdomains that refer to actual hosts (A and AAAA records). This is still the most efficient way to handle your ip addresses for your actual machines especially when you also support ipv6.

The most frustrating thing here is that the behavior differs on platforms and applications so it took a while before this was discovered.

  • Recent Posts
  • Recent Comments
  • Archives
  • Categories
  • Meta