go – Why GDB shows all zero values for a large map-ThrowExceptions

Exception or error:

I am a newbie in GDB/Go. I try to use GDB to debug a performance problem, where increasing an (already-large, ~800K entries) map by a few items (~400 entries) suddenly speeds up processing. I guess this is related to memory. I tried to print out the map variable in GDB before and after adding those entries, as shown in the attached screenshots. In the slightly-bigger-map case, all the values printed by GDB are zero. Does anybody know what is causing this? I am guessing this is related to some memory optimizations performed by Go.

GDB screenshot with a bigger map showing all zero values

GDB screenshot with a slightly-small map showing normal values

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *