Posts

Showing posts with the label memory-leaks

Python process in loop or re-scheduled memory leak

Image
Clash Royale CLAN TAG #URR8PPP Python process in loop or re-scheduled memory leak I have a function running inside a dedicated multiprocessing process, which can run endlessly in a loop, re-scheduled itself using threading timer or run only one time. In the first and second case, the memory usage is endlessly leaking, even though I am just updating the references to my variables in the endless loop mode. I use a queue for communication with the main process and pop everything out of it right away from the main process. Here is the function code : def schedule(args, fn, q = None ): isendless = True while isendless: # retrieve from database pd_original_matrice = get_rating(args); # save userID / index correspondance index = pd_original_matrice['CustomerId'].values index = dict( zip(index, list(range(0, len(index))) )) now = dt.now().replace(microsecond=0) # start timer mf = MF(pd_original_matrice.iloc[:,1:].fillna(0)...

mysqli_query single query gerenating PHP fatal error: Allowed memory size exhausted

Image
Clash Royale CLAN TAG #URR8PPP mysqli_query single query gerenating PHP fatal error: Allowed memory size exhausted I have a Mysql table (named "base") with 3 million records , which is composed of only 3 int(10) fields . When I try to run this simple query $result = mysqli_query($db, 'SELECT * FROM base') , php shows the error: $result = mysqli_query($db, 'SELECT * FROM base') PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 10485768 bytes) in C:xampphtdocscombina.php on line 17 PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 10485768 bytes) in C:xampphtdocscombina.php on line 17 I think mysqli_query should not load all the table records into memory, right? So why the memory overflow? I'm using XAMPP installation on Windows 10, PHP 7.2. Here is the code: $servername = "localhost"; $ult_elemsername = "root"; $password = ""; $dbname = "comb"; $d...