memory corruption WideCharToMultiByte

Recently I have been debugging some memory corruption that happened only after something executed 64 times, free complained that memory has been corrupted. Thus started the usual process of debugging. I started ApplicationVerifier and set the application and enabled the basic checks.

Application Verifier- Basic Checks

Application Verifier- Basic Checks

Soon my application started failing with access violation during startup, this happened even before I reached the code where memory was corrupted. Now I have two problems to investigate. This time I was crashing with call to WideCharToMultiByte. Started debugging to see exactly where it was failing:

  ntdll.dll!RtlUnicodeToUTF8N() Unknown
  KernelBase.dll!WideCharToMultiByte() Unknown
  vfbasics.dll!000007fef081cd0c() Unknown
> heapcorruption.exe!dllNotificationFunction(unsigned long NotificationReason, const _LDR_DLL_NOTIFICATION_DATA * NotificationData, void * Context) Line 64 C++
  ntdll.dll!string "Enabling heap debug options\n"() Unknown
  ntdll.dll!LdrpFindOrMapDll() Unknown
  ntdll.dll!LdrpLoadDll() Unknown
  ntdll.dll!LdrLoadDll() Unknown
  vfbasics.dll!000007fef08074de() Unknown
  KernelBase.dll!LoadLibraryExW() Unknown
  heapcorruption.exe!main() Line 94 C++
  heapcorruption.exe!invoke_main() Line 75 C++

[Read More]

over to hugo

Have been using octopress for a while now, but one thing i dont like is it’s reliance on ruby and time it takes to regenerate. Found that hugo is much better at these. Earlier site regeneration used to take ~5 minutes now happens in ~.2 seconds! Thus came the attraction of moving over- but as i found i am not the first to do so. I have read various posts and these are my steps to port it over:

The best part is no more rubydevkit and gem/bundler installs, what a big relief

[Read More]

C# yaml config

yaml is pretty good way to define config for an application rather than xml file. There are many libraries available for parsing yaml in C#. Two of the libraries i tried are: yamlconfig and sharpyaml. I liked the general concept behind yamlconfig but it wasn’t that good to just integrate and get started, so I chose sharpyaml over it. The thing I liked about sharpyaml is how easy it is to get it going, I did not had much success with yamlconfig. [Read More]

vimrc

These days vim is preferred editor, and have started using it at work and home alike. That means my vimrc kept evolving and had to sync at both the sites. Thought would back it up some where I can handily find it when required.

This post has all the contents of my vimrc as backup

[Read More]

deleting all matching files recursively

I am a big fan of linux command line utils and work with many of those on windows as well. One of the commands I have started to like is xargs. I Like the way you could compose commands with pipes. Have tried using xargs on windows without much success.

One of the things I often use this is to clean temp directories of certain log files. My linux commands would have been:

find . -name "*.syslog" | xargs rm

Now I could have done this on windows as:

dir /s /b *.syslog | xargs rm

but xargs dies with environment being too large, instead had to switch to a less elegant solution:

forfiles /s /p . /M *.syslog /c "cmd /c rm @path"

[Read More]