c++ - Memory failures when calling new -


it might little hard explain error i'll try best. unfortunately code large unpractical try include it.

i writing academic os homework (nachos if must know) , recent thing needed implement mutual exclusion in core map. added lock , condition variable per page in emulated main memory. after doing run code , through 1 call exception (in different directory core map) handler fine, second time function gets called , error on following call: r=new lock("read"); , reads this:

*** glibc detected *** /home/some_other_directories/workspace/nachos3_repo/vm/nachos: malloc(): memory corruption (fast): 0x0805fe20 *** 

just see how behaves changed allocation of lock extern in system file (there lot of global externs there) , after seg fault on call fout.open("old.txt"); traced through stack within call malloc in call new.

my best guess heap getting large not sure if case or how handle if is. can shed light on problem?

malloc victim here. in different part of code have written outside allocated boundaries , have corrupted chain links used heap manager track free/allocated blocks. try allocate here, heap manager chasing these linked lists , lands protected area (most not allocated). should review of your changes first , see if can spot scribble memory.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -