dirkwhoffmann / vAmiga

vAmiga is a user-friendly Amiga 500, 1000, 2000 emulator for macOS
https://dirkwhoffmann.github.io/vAmiga
Other
293 stars 24 forks source link

memory footprint (V1.x Vs. V2.x) #735

Closed mibosshard closed 1 year ago

mibosshard commented 1 year ago

V1.0.2 approx. 165 MB V2.1 approx. 720 MB

any idea as of why that is?

dirkwhoffmann commented 1 year ago

any idea as of why that is?

I have no idea at the moment. The numbers on a M2 MacBook Air are even worse. Left is v2.1, right is v1.02:

Bildschirmfoto 2022-09-12 um 07 08 37

I've also checked the app sizes. Fortunately, they didn't get out of control over time (of course they have nothing to do with memory footprint):

Bildschirmfoto 2022-09-12 um 07 14 43
mras0 commented 1 year ago

vAmigaCore (i.e. without a frontend) doesn't use excess memory with the latest code from the dev branch. Checked with MSVC's memory usage debug tool all large (>500K) allocations are for expected things. Adding hard drives increases memory usage proportionally to the disk size(s). If this is for comparable configurations (e.g. standard HD-less A500) it's likely something in the frontend (snapshots?).

dirkwhoffmann commented 1 year ago

Culprit is commit d52e337.

Memory is consumed by the drop zone images. Prior to this commit, I had a separate image for df0, ..., df3, hd0, ..., hd3 in the assets folder. In this commit, I've added code to imprint the drive labels programatically (in order to reduce the number of images in the assets folder):

    class func createImage(_ name: String, label: String) -> NSImage {

        let img = NSImage(named: name)!.copy() as! NSImage
        img.imprint(text: label, x: 235, y: 330, fontSize: 100, tint: "black")
        return img
    }

I guess the image are created in a very high resolution which causes the large memory footprint. I'll investigate this further...

dirkwhoffmann commented 1 year ago
Bildschirm­foto 2022-12-23 um 14 19 56

Memory usage is back at normal.

I've fixed the issue on the v2.2 branch, so it will be part of 2.2.1, too.

dirkwhoffmann commented 1 year ago

Fixed.