The "memory detection" logic used in v2.01 and v3a8 could be improved.

It currently does stat("/proc/kcore") and takes the returned st_size value as the basis for memory size, which is good. But the way it uses that value is not always the best.

It appears to first determine the type of unit (Mk1, Mk2, Mk2a) it is running on, and then assumes a certain base memory size based on that. It then subracts this base amount from that reported by stat("/proc/kcore"), and calculates cache size based on the difference.

But it does NOT check for a negative number here, which means that if the kernel under-reports the size, the player will try to allocate HUMONGOUS amounts of cache (gigabytes), and die a horrible death.

It would be better if, for Mk2/Mk2a, the player software could simply accept the value from stat("/proc/kcore") and subtract it's fixed overhead (and ReserveCache setting) from it, and calculate cache size based on this result.

Background: Hijack would like to obsolete the need to twiddle with ReserveCache settings, by providing a menu function for this instead, which simply tweaks the reported memory size returned from stat("/proc/kcore"). This would allow Hijack to account for its own overhead automatically, hopefully reducing the incidence of mysterious player crashes.

Cheers


Edited by mlord (31/07/2004 19:11)