fix the memory leak issue
add the base class for KL methods
Merge pull request #2287 from yorkerlin/develop

The base KL method class