I've got the 0.4.5 release .EXE with symbols from Darkvater, and have got some really weird results with random breaks at various places...
One time, it broke in the process of threaded autosave while trying to clean the memory pool, calling CleanPool(_ts.save) with a NULL pointer, even though _ts.save was OK:
Call stack:
free(void * pBlock=0x01c4bff8) Line 101 + 0xe bytes
> CleanPool(MemoryPool * pool=0x00000000) Line 20 + 0xb bytes
UnInitMem() Line 940
SaveFileToDisk(void * arg=0x00000000) Line 1338
Proxy(void * arg=0x00ddf9d0) Line 109 + 0xa bytes
- _ts {save=0x004c664c count=2086489 ff_state='' ...} ThreadedSave
- save 0x004c664c {name=0x004c664c "Savegame" max_blocks=500 block_size_bits=17 ...} MemoryPool *
+ name 0x004c664c "Savegame" const unsigned char [10]
max_blocks 500 const unsigned int
block_size_bits 17 const unsigned int
item_size 1 const unsigned int
new_block_proc 0x00000000 void (unsigned int)*
current_blocks 16 unsigned int
total_items 2097152 unsigned int
- blocks 0x01c28ff8 unsigned char * *
- 0x01c4bff8 "MAPS" unsigned char *
77 'M' unsigned char
count 2086489 unsigned int
ff_state 1 '␁' unsigned char
saveinprogress 1 '␁' unsigned char
cursor 0 unsigned int
It broke 2 times in total when trying to malloc 16 more bytes for a node in HashSet(), and again, NPFRouteInternal() was calling AyStarMain(&_npf_aystar) and the pointer to _npf.asystar was NULL as well
_heap_alloc(unsigned int size=16) Line 211 + 0xf bytes
_nh_malloc(unsigned int size=16, int nhFlag=0) Line 113
malloc(unsigned int size=16) Line 54 + 0xf bytes
> Hash_Set(Hash * h=0x00000000, unsigned int key1=0, unsigned int key2=1, void * value=0x022dcfb0) Line 698 + 0x7 bytes
AyStarMain_ClosedList_Add(AyStar * aystar=0x004d2618, PathNode * node=0x0012faa4) Line 36 + 0x15 bytes
AyStarMain_Loop(AyStar * aystar=0x00000000) Line 162
AyStarMain_Main(AyStar * aystar=0x00000000) Line 226 + 0x8 bytes
NPFRouteInternal(AyStarNode * start1=0x0012fb54, AyStarNode * start2=0x0012fae0, NPFFindStationOrTileData * target=0x0012fc1c, int (AyStar *, OpenListNode *)* target_proc=0x004182bf, int (AyStar *, AyStarNode *, OpenListNode *)* heuristic_proc=0x00000000, TransportTypes type=TRANSPORT_WATER, Owner owner=2, RailTypes railtype=INVALID_RAILTYPE, unsigned int reverse_penalty=0) Line 688
NPFRouteToStationOrTileTwoWay(unsigned int tile1=0, Trackdirs trackdir1=TRACKDIR_DIAG1_NE, unsigned int tile2=0, Trackdirs trackdir2=TRACKDIR_DIAG1_NE, NPFFindStationOrTileData * target=0x0012fc1c, TransportTypes type=TRANSPORT_WATER, Owner owner=2, RailTypes railtype=INVALID_RAILTYPE) Line 714 + 0x52 bytes
NPFRouteToStationOrTile(unsigned int tile=42762, Trackdirs trackdir=1244188, NPFFindStationOrTileData * target=0x0012fc1c, TransportTypes type=TRANSPORT_WATER, Owner owner=2, RailTypes railtype=INVALID_RAILTYPE) Line 719 + 0x1d bytes
ChooseShipTrack(Vehicle * v=0x00000000, unsigned int tile=201368842, int enterdir=3, unsigned int tracks=8) Line 546 + 0x1d bytes
ShipController(Vehicle * v=0x00000000) Line 752
CallVehicleTicks() Line 616 + 0xc bytes
And two times in clear_Hash
> clear_Hash(Hash * h=0x00000000, unsigned char free_values='') Line 574 + 0x8 bytes
AyStarMain_Clear(AyStar * aystar=0x00000000) Line 205 + 0xd bytes
AyStarMain_Main(AyStar * aystar=0x00000000) Line 240
NPFRouteInternal(AyStarNode * start1=0x0013fb54, AyStarNode * start2=0x0013fae0, NPFFindStationOrTileData * target=0x0013fc1c, int (AyStar *, OpenListNode *)* target_proc=0x004182bf, int (AyStar *, AyStarNode *, OpenListNode *)* heuristic_proc=0x00000000, TransportTypes type=TRANSPORT_WATER, Owner owner=2, RailTypes railtype=INVALID_RAILTYPE, unsigned int reverse_penalty=0) Line 688
NPFRouteToStationOrTileTwoWay(unsigned int tile1=0, Trackdirs trackdir1=TRACKDIR_DIAG1_NE, unsigned int tile2=0, Trackdirs trackdir2=TRACKDIR_DIAG1_NE, NPFFindStationOrTileData * target=0x0013fc1c, TransportTypes type=TRANSPORT_WATER, Owner owner=2, RailTypes railtype=INVALID_RAILTYPE) Line 714 + 0x52 bytes
NPFRouteToStationOrTile(unsigned int tile=46819, Trackdirs trackdir=1309724, NPFFindStationOrTileData * target=0x0013fc1c, TransportTypes type=TRANSPORT_WATER, Owner owner=2, RailTypes railtype=INVALID_RAILTYPE) Line 719 + 0x1d bytes
ChooseShipTrack(Vehicle * v=0x00000000, unsigned int tile=151041251, int enterdir=3, unsigned int tracks=42) Line 546 + 0x1d bytes
ShipController(Vehicle * v=0x00000000) Line 752
One time it probably received a null vehicle pointer on GetVehicle from the vehicle pool (not shown in the stack frame because it's inline):
_nh_malloc(unsigned int size=14090240, int nhFlag=0) Line 113
free(void * pBlock=0x00e6de78) Line 101 + 0xe bytes
> Clear_Hash(Hash * h=0x00000000, unsigned char free_values='') Line 575 + 0x6 bytes
AyStarMain_Clear(AyStar * aystar=0x00000000) Line 205
AyStarMain_Main(AyStar * aystar=0x00000000) Line 240
NPFRouteToDepotTrialError(unsigned int tile=153085, Trackdirs trackdir=TRACKDIR_DIAG2_SE, TransportTypes type=TRANSPORT_RAIL, Owner owner=0, RailTypes railtype=1244208) Line 837
FindClosestShipDepot(const Vehicle * v=0x00000000) Line 71 + 0x17 bytes
CheckIfShipNeedsService(Vehicle * v=0x00000000) Line 106 + 0x7 bytes
OnNewDay_Ship(Vehicle * v=0x00000000) Line 135
RunVehicleDayProc(unsigned int daytick=0) Line 492
IncreaseDate() Line 511
Then it broke numerous times on malloc() of 24 bytes in AyStarMain_OpenList_Add(), which I don't get at all...
_heap_alloc(unsigned int size=24) Line 211 + 0xf bytes
_nh_malloc(unsigned int size=24, int nhFlag=0) Line 113
malloc(unsigned int size=24) Line 54 + 0xf bytes
> AyStarMain_OpenList_Add(AyStar * aystar=0x004d2618, PathNode * parent=0x00e5df50, AyStarNode * node=0x004d2668, int f=3957, int g=3075) Line 64 + 0x7 bytes
AyStarMain_CheckTile(AyStar * aystar=0x00000000, AyStarNode * current=0x00000000, OpenListNode * parent=0x00000f75) Line 128
AyStarMain_Loop(AyStar * aystar=0x00000000) Line 167 + 0xb bytes
AyStarMain_Main(AyStar * aystar=0x00000000) Line 226 + 0x8 bytes
NPFRouteInternal(AyStarNode * start1=0x0012fb54, AyStarNode * start2=0x0012fae0, NPFFindStationOrTileData * target=0x0012fc1c, int (AyStar *, OpenListNode *)* target_proc=0x004182bf, int (AyStar *, AyStarNode *, OpenListNode *)* heuristic_proc=0x00000000, TransportTypes type=TRANSPORT_WATER, Owner owner=2, RailTypes railtype=INVALID_RAILTYPE, unsigned int reverse_penalty=0) Line 688
NPFRouteToStationOrTileTwoWay(unsigned int tile1=0, Trackdirs trackdir1=TRACKDIR_DIAG1_NE, unsigned int tile2=0, Trackdirs trackdir2=TRACKDIR_DIAG1_NE, NPFFindStationOrTileData * target=0x0012fc1c, TransportTypes type=TRANSPORT_WATER, Owner owner=2, RailTypes railtype=INVALID_RAILTYPE) Line 714 + 0x52 bytes
NPFRouteToStationOrTile(unsigned int tile=47330, Trackdirs trackdir=1244188, NPFFindStationOrTileData * target=0x0012fc1c, TransportTypes type=TRANSPORT_WATER, Owner owner=2, RailTypes railtype=INVALID_RAILTYPE) Line 719 + 0x1d bytes
ChooseShipTrack(Vehicle * v=0x00000000, unsigned int tile=201373410, int enterdir=3, unsigned int tracks=42) Line 546 + 0x1d bytes
ShipController(Vehicle * v=0x00000000) Line 752
CallVehicleTicks() Line 616 + 0xc bytes
_heap_alloc(unsigned int size=24) Line 211 + 0xf bytes
_nh_malloc(unsigned int size=24, int nhFlag=0) Line 113
malloc(unsigned int size=24) Line 54 + 0xf bytes
> AyStarMain_OpenList_Add(AyStar * aystar=0x004d2618, PathNode * parent=0x00e75188, AyStarNode * node=0x004d2688, int f=7054, int g=6530) Line 64 + 0x7 bytes
AyStarMain_CheckTile(AyStar * aystar=0x00000000, AyStarNode * current=0x00000000, OpenListNode * parent=0x00001b8e) Line 128
AyStarMain_Loop(AyStar * aystar=0x00000000) Line 167 + 0xb bytes
AyStarMain_Main(AyStar * aystar=0x00000000) Line 226 + 0x8 bytes
NPFRouteInternal(AyStarNode * start1=0x0012fb54, AyStarNode * start2=0x0012fae0, NPFFindStationOrTileData * target=0x0012fc1c, int (AyStar *, OpenListNode *)* target_proc=0x004182bf, int (AyStar *, AyStarNode *, OpenListNode *)* heuristic_proc=0x00000000, TransportTypes type=TRANSPORT_WATER, Owner owner=2, RailTypes railtype=INVALID_RAILTYPE, unsigned int reverse_penalty=0) Line 688
NPFRouteToStationOrTileTwoWay(unsigned int tile1=0, Trackdirs trackdir1=TRACKDIR_DIAG1_NE, unsigned int tile2=0, Trackdirs trackdir2=TRACKDIR_DIAG1_NE, NPFFindStationOrTileData * target=0x0012fc1c, TransportTypes type=TRANSPORT_WATER, Owner owner=2, RailTypes railtype=INVALID_RAILTYPE) Line 714 + 0x52 bytes
NPFRouteToStationOrTile(unsigned int tile=83535, Trackdirs trackdir=1244188, NPFFindStationOrTileData * target=0x0012fc1c, TransportTypes type=TRANSPORT_WATER, Owner owner=2, RailTypes railtype=INVALID_RAILTYPE) Line 719 + 0x1d bytes
ChooseShipTrack(Vehicle * v=0x00000000, unsigned int tile=134301264, int enterdir=2, unsigned int tracks=37) Line 546 + 0x1d bytes
ShipController(Vehicle * v=0x00000000) Line 752
_heap_alloc(unsigned int size=24) Line 211 + 0xf bytes
_nh_malloc(unsigned int size=24, int nhFlag=0) Line 113
malloc(unsigned int size=24) Line 54 + 0xf bytes
> AyStarMain_OpenList_Add(AyStar * aystar=0x004d2618, PathNode * parent=0x01588078, AyStarNode * node=0x004d2678, int f=7409, int g=1270) Line 64 + 0x7 bytes
AyStarMain_CheckTile(AyStar * aystar=0x00000000, AyStarNode * current=0x00000000, OpenListNode * parent=0x00001cf1) Line 128
AyStarMain_Loop(AyStar * aystar=0x00000000) Line 167 + 0xb bytes
AyStarMain_Main(AyStar * aystar=0x00000000) Line 226 + 0x8 bytes
NPFRouteInternal(AyStarNode * start1=0x0013fb54, AyStarNode * start2=0x0013fae0, NPFFindStationOrTileData * target=0x0013fc1c, int (AyStar *, OpenListNode *)* target_proc=0x004182bf, int (AyStar *, AyStarNode *, OpenListNode *)* heuristic_proc=0x00000000, TransportTypes type=TRANSPORT_WATER, Owner owner=2, RailTypes railtype=INVALID_RAILTYPE, unsigned int reverse_penalty=0) Line 688
NPFRouteToStationOrTileTwoWay(unsigned int tile1=0, Trackdirs trackdir1=TRACKDIR_DIAG1_NE, unsigned int tile2=0, Trackdirs trackdir2=TRACKDIR_DIAG1_NE, NPFFindStationOrTileData * target=0x0013fc1c, TransportTypes type=TRANSPORT_WATER, Owner owner=2, RailTypes railtype=INVALID_RAILTYPE) Line 714 + 0x52 bytes
NPFRouteToStationOrTile(unsigned int tile=39213, Trackdirs trackdir=1309724, NPFFindStationOrTileData * target=0x0013fc1c, TransportTypes type=TRANSPORT_WATER, Owner owner=2, RailTypes railtype=INVALID_RAILTYPE) Line 719 + 0x1d bytes
ChooseShipTrack(Vehicle * v=0x00000000, unsigned int tile=134256942, int enterdir=2, unsigned int tracks=37) Line 546 + 0x1d bytes
ShipController(Vehicle * v=0x00000000) Line 752
CallVehicleTicks() Line 616 + 0xc bytes
_heap_alloc(unsigned int size=16) Line 211 + 0xf bytes
_nh_malloc(unsigned int size=16, int nhFlag=0) Line 113
malloc(unsigned int size=16) Line 54 + 0xf bytes
> Hash_Set(Hash * h=0x00000000, unsigned int key1=0, unsigned int key2=9, void * value=0x01b71040) Line 698 + 0x7 bytes
AyStarMain_OpenList_Add(AyStar * aystar=0x004d2618, PathNode * parent=0x015207c8, AyStarNode * node=0x004d2668, int f=14072, int g=5110) Line 71
AyStarMain_CheckTile(AyStar * aystar=0x00000000, AyStarNode * current=0x004d2618, OpenListNode * parent=0x000036f8) Line 128
AyStarMain_Loop(AyStar * aystar=0x00000000) Line 167 + 0xb bytes
AyStarMain_Main(AyStar * aystar=0x00000000) Line 226 + 0x8 bytes
NPFRouteInternal(AyStarNode * start1=0x0013fb54, AyStarNode * start2=0x0013fae0, NPFFindStationOrTileData * target=0x0013fc1c, int (AyStar *, OpenListNode *)* target_proc=0x004182bf, int (AyStar *, AyStarNode *, OpenListNode *)* heuristic_proc=0x00000000, TransportTypes type=TRANSPORT_WATER, Owner owner=6, RailTypes railtype=INVALID_RAILTYPE, unsigned int reverse_penalty=0) Line 688
NPFRouteToStationOrTileTwoWay(unsigned int tile1=0, Trackdirs trackdir1=TRACKDIR_DIAG1_NE, unsigned int tile2=0, Trackdirs trackdir2=TRACKDIR_DIAG1_NE, NPFFindStationOrTileData * target=0x0013fc1c, TransportTypes type=TRANSPORT_WATER, Owner owner=6, RailTypes railtype=INVALID_RAILTYPE) Line 714 + 0x52 bytes
NPFRouteToStationOrTile(unsigned int tile=115709, Trackdirs trackdir=1309724, NPFFindStationOrTileData * target=0x0013fc1c, TransportTypes type=TRANSPORT_WATER, Owner owner=6, RailTypes railtype=INVALID_RAILTYPE) Line 719 + 0x1d bytes
ChooseShipTrack(Vehicle * v=0x00000000, unsigned int tile=151110141, int enterdir=3, unsigned int tracks=42) Line 546 + 0x1d bytes
ShipController(Vehicle * v=0x00000000) Line 752
CallVehicleTicks() Line 616 + 0xc bytes
And the very last time:
> WndProcGdi(HWND__ * hwnd=0x0013fbc4, unsigned int msg=1, unsigned int wParam=0, long lParam=0) Line 207
FindClosestTrainDepot(Vehicle * v=0x00000000) Line 1783 + 0x2d bytes
CheckIfTrainNeedsService(Vehicle * v=0x0013fc10) Line 3390 + 0xb bytes
OnNewDay_Train(Vehicle * v=0x00000000) Line 3445
RunVehicleDayProc(unsigned int daytick=0) Line 492
IncreaseDate() Line 511
Any ideas?
[Edit] Cut some minor details and added some more stacks