Skip to content

High memory usage on macOS in headless mode.  #1916

Closed
@sarkrui

Description

@sarkrui

So the issue with the same following (chopped) code didn't occur in GUI mode. With --headless arg, Google Chrome instance could take up to 10GiB of ram. Hasn't anyone encountered the same? or is there anything wrong with my code? Thank you, very appreciated.

from collections import deque
from datetime import datetime, timedelta
import argparse
import csv
import os
import logging
import random
import signal
import socket
import sys
import time
import datetime
import threading
import requests
import tracemalloc
import pandas as pd
import paramiko
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException,ElementNotInteractableException
from seleniumbase import BaseCase
from seleniumbase import MasterQA
from jinja2 import Environment, FileSystemLoader

[some code here]

class AmazonFlow(BaseCase):
	[some code here]
    def test_amazon_flow(self):
        try:
            
            # Set Amazon and check location
            self.set_amazon()

            while not self.check_location():
                self.set_amazon()

            # start the heartbeat thread
            # heartbeat_thread.start()

            
            # Continue with price checking indefinitely
            while True:
                # Only proceed if check_prices returns True
                self.check_prices()
                
                time.sleep(10) 
                
                # convert CSV to nice-looking HTML after checking prices
                csv_to_bootstrap_html('price.csv', 'price.html','template.html')  

                # upload the generated HTML to the server
                upload_file_via_ssh()

        except KeyboardInterrupt:
            print("Interrupted by user")
        except Exception as e:
            print(f"An error occurred: {e}")
        finally:
            self.tearDown()

if __name__ == "__main__":
    BaseCase.main(__name__, __file__,"--uc","--incognito")

Metadata

Metadata

Assignees

No one assigned

    Labels

    UC Mode / CDP ModeUndetected Chromedriver Mode / CDP Modecan't reproduceWe tried to see what you saw, but didn'tquestionSomeone is looking for answers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions