wiedehopf / readsb

ADS-B decoder swiss knife
Other
361 stars 79 forks source link

Question in globe_index.c #76

Closed olyair11 closed 4 months ago

olyair11 commented 4 months ago

In globe_index.c source file, in handleHeatmap function (starting at Line 3119) Please explain, I would like to understand the statement in Line 3157: int64_t alloc = (50 + Modes.globalStatsCount.readsb_aircraft_with_position) * num_slices; why extra 50 Bytes are allocated for ? Thanks

wiedehopf commented 4 months ago

the *=3 in heatmapCheckAlloc is much more wasteful.

Neither should be an issue, heatmap entries are pretty small. In other words, it just doesn't matter.

Also that's not an extra 50 bytes, that's not how alloc is used.

Might not answer other questions like this unless it's about a potential issue. This programs has a bunch of arbitrary choices that aren't the cleanest programming style, so unless there isn't enough buffer allocated or there is buffer being allocated that's actually causing someone to run out of memory, i'm not too concerned.