1

I have a problem when I run rails s or rails routes, most of the time I will get the following error message:

ruby(2177,0x7fff96a0b3c0) malloc: *** error for object 0x7f8b8d004c40: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

I have tried all solutions here but it doesn't help, any ideas?

Brian Law
  • 460
  • 1
  • 4
  • 18
  • try this https://stackoverflow.com/questions/10922777/debugging-malloc-errors-in-ruby-on-mac-os-x – Hardik Upadhyay Jul 05 '17 at 07:19
  • thanks man, but since i have no `Repair Disk Permissions` in Disk Utility, I ran First Aid which i tried before in Recovery Mode, but still it does not work. is that a random problem? – Brian Law Jul 05 '17 at 07:36
  • even reinstall the macOS(without deleting files) does not work for me, gonna try formatting the whole thing in the weekend if I can't fix it. – Brian Law Jul 05 '17 at 08:49
  • i think this will help you https://stackoverflow.com/questions/26478906/ruby-errors-with-os-x-yosemite – Hardik Upadhyay Jul 05 '17 at 09:03
  • just tried to do it in my free time, but still it is not working :( – Brian Law Jul 10 '17 at 04:58

1 Answers1

0

After I tried clean reinstall MacOS, the error still exist, so the error must be in my code.

But since malloc is a C thing, I took a closer look at the gems I am currently using, and found one of the gem is a C extension.

I removed that gem, and everything is fine, just I have to find a alternative to that gem.

Brian Law
  • 460
  • 1
  • 4
  • 18