mirror of
https://github.com/hoornet/vega.git
synced 2026-06-21 11:58:24 -07:00
Fix feed OOM: cap follow feed at 30, WebKit software rendering, dedup notification fetches
- followNotes capped at 30 (was 80) — following feed was rendering 2.7x more notes than global, causing 4GB+ spike on media-heavy follow content - fetchFollowFeed limit 80→30 to match - WEBKIT_FORCE_SOFTWARE_RENDERING=1 replaces WEBKIT_DISABLE_COMPOSITING_MODE=1 (compositing mode killed Wayland path → blank window on Hyprland) - HardwareAccelerationPolicy::Never → OnDemand (Never also caused blank screen) - set_enable_page_cache(false) — SPA never navigates, bfcache is pure waste - Removed duplicate fetchNotifications calls on login (was firing 3x in 8s) - First notification poll delayed 8s→90s to avoid competing with feed load - Result: login 3600MB→453MB, following feed crash→737MB, plateau at ~950MB
This commit is contained in:
+11
-6
@@ -436,7 +436,7 @@ pub fn run() {
|
||||
}
|
||||
}
|
||||
|
||||
// ── WebKit GPU workaround for Linux (webkit2gtk 2.50+ black screen) ──
|
||||
// ── WebKit memory tuning for Linux (webkit2gtk) ──────────────────
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
let main_window = app.get_webview_window("main").unwrap();
|
||||
@@ -444,15 +444,20 @@ pub fn run() {
|
||||
use webkit2gtk::{CacheModel, SettingsExt, WebContextExt, WebViewExt};
|
||||
let wv = webview.inner();
|
||||
if let Some(settings) = wv.settings() {
|
||||
// OnDemand: use GPU if available, CPU fallback otherwise.
|
||||
// HardwareAccelerationPolicy::Never + WEBKIT_DISABLE_COMPOSITING_MODE=1
|
||||
// both kill the Wayland compositor path → blank window on Hyprland.
|
||||
// WEBKIT_FORCE_SOFTWARE_RENDERING=1 (set in main.rs) forces CPU
|
||||
// rasterization without disrupting the Wayland surface.
|
||||
settings.set_hardware_acceleration_policy(
|
||||
webkit2gtk::HardwareAccelerationPolicy::Never,
|
||||
webkit2gtk::HardwareAccelerationPolicy::OnDemand,
|
||||
);
|
||||
// Vega is a SPA — no back/forward navigation, page cache is pure waste.
|
||||
settings.set_enable_page_cache(false);
|
||||
}
|
||||
// Minimize WebKit's in-memory content cache (decoded images, scripts, etc.)
|
||||
// Default is WebBrowser which caches aggressively. DocumentViewer is the
|
||||
// minimum: no back/forward page cache, smallest memory footprint.
|
||||
// This is safe for Vega — it's a single-page app, never navigates between pages.
|
||||
if let Some(ctx) = wv.context() {
|
||||
// DocumentViewer: smallest in-memory content cache footprint.
|
||||
// No back/forward page cache, only the active document cached.
|
||||
ctx.set_cache_model(CacheModel::DocumentViewer);
|
||||
}
|
||||
}).ok();
|
||||
|
||||
@@ -7,12 +7,11 @@ fn main() {
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
std::env::set_var("WEBKIT_DISABLE_DMABUF_RENDERER", "1");
|
||||
// Required on Linux with large RAM/swap: WebKitGTK compositor pre-allocates
|
||||
// ~25% of total virtual memory (RAM+swap) for its tile cache. On a 14GB RAM +
|
||||
// 19GB swap system this is ~4 GB, filling all RAM and freezing the machine.
|
||||
// Software rendering is slower but memory-safe. Fix: reduce swap or implement
|
||||
// virtual scrolling (fewer compositor layers).
|
||||
std::env::set_var("WEBKIT_DISABLE_COMPOSITING_MODE", "1");
|
||||
// Force CPU-only rasterization while keeping the Wayland compositor path intact.
|
||||
// WEBKIT_DISABLE_COMPOSITING_MODE=1 kills the GPU process but also breaks Wayland
|
||||
// rendering (blank window on Hyprland). WEBKIT_FORCE_SOFTWARE_RENDERING=1 cuts GPU
|
||||
// RAM without disrupting the Wayland surface — the right tradeoff on this machine.
|
||||
std::env::set_var("WEBKIT_FORCE_SOFTWARE_RENDERING", "1");
|
||||
}
|
||||
|
||||
vega_lib::run()
|
||||
|
||||
Reference in New Issue
Block a user