HaikuArchives / StreamRadio

Haiku-native application to search for and listen to internet radio stations.
8 stars 11 forks source link

StationFinderRadioNetwork: Huge memory leak from icons #31

Closed CodeforEvolution closed 11 months ago

CodeforEvolution commented 4 years ago

What:

While going through with my StreamRadio clean up, I noticed that when using the Station Finder, icons are downloaded for all stations on the list (at least only one icon is downloaded at a time).

Besides the fact that Station Finder will essentially download any station icons without regard for your RAM, there is another big problem with this: Once you close the Station Finder window, all the memory absorbed from the downloaded station icons are not freed, and worse, these downloaded images are not reused for separate searches that find the same stations. The BBitmap memory is at least “freed” when the main window is closed and the StreamRadio application quits, however, I don’t know is the corresponding ServerBitmaps within the app_server are also being freed...

How:

The StationFinderRadioNetwork class and the StationFinder class will need to be reworked. Maybe a HashMap could be formed between a station’s unique identifier and the station’s icon to be able to reuse icons?

korli commented 11 months ago

fixed in 1ece894e2059dc53fcbbd053363ec20b2b971111