Import – Why does Mathematica consume so much memory when reading binary data?

There are similar questions here, but in this case I could not find a satisfactory answer: I import a 1.7 GB binary file with the following command:

BinaryReadList("/path/to/file", "Real64")

It works fine, but memory usage reaches a peak of 18 GB during the import process, which is about ten times the file size. Is there a more efficient way to do this? Why does Mathematica use so much memory?

(I use Mathematica 12 on Ubuntu)

Memory – Against a system that stops UID / GID = 0 processes in Android

For example, suppose there is a security system in an Android kernel that is designed to prevent exploits with arbitrary read / write access to kernel memory from getting root privileges. This system,

  1. Ends a process by using force_sig () with SIGKILL if the process UID or GID is 0 and the system decides that it does not.
  2. Depends on kernel variables that are read-only after init. (On / off status)

What can an exploit do to counter this system and obtain root IDs, assuming that the system in (1) above decides with complete accuracy and KASLR is not present on the device?

What comes to my mind:

  1. Temporarily disable SIGKILL:
    If SIGKILL can be temporarily disabled (or even restarted), the system is essentially useless, but I still need to find a way to disable SIGKILL through kernel memory write.
  2. Disable the system by somehow mirroring the read-only bits:
    This is probably not possible, but included for the sake of completeness.
  3. Edit the text sections of kernel memory to patch the functions:
    It is also unlikely that this is possible because the text section is read-only.

python – Memory runs out when trying to convert images to numpy arrays

I have a list of about 15,000 images that are 120×90 pixels high and wide. I'm trying to convert them to a Numpy Array form, but when I try to convert them, my computer does not have enough memory (8 GB RAM + 12 GB swap). After this is done, I save it in a file for future machine learning exercises.

dataSet = genDataSet()
for image in dataSet:
    pixelImages.append((imageToRGB(image(0), True),image(1)))

def imageToRGB(inputFile, normalise = False):
    os.chdir("/home/spchee/CodeProjects/School Project/images")
    img = #Opens File
    pixels = np.asarray(img) #Converts it to a numpy array
    pixels = np.rint(pixels)
    if normalise: #This normalises it between the values of 0 and 1
        pixels= pixels/255
    return pixels

The function genDataSet () returns a list in the form of ((filepath1, genre), (filepath2, genre) …).

When this code runs, there is not enough memory left, so my computer freezes almost completely and I am forced to stop it.

Memory and vector problem of a JOKENPO game – Python

I have to save the results of the winner in a vector and there is a draw.

I also have to repeat the code until the user decides when to log out (any number he does not type as 1,2,3). When he logs out, the user's profit and tie percentage must be specified.

from random import randint

itens = ('0', 'Pedra', 'Papel', 'Tesoura')
computador = randint(1, 3)

(1) Pedra (2) Papel (3) Tesoura''')

jogador = int(input('-> '))

if jogador != 1 and jogador != 2 and jogador !=3:
    print('Você não pode fazer isso!')

    print('O computador jogou {}'.format(itens(computador)))
    print('O jogador jogou {}'.format(itens(jogador)))

if computador == 1:
    if jogador == 1:
    elif jogador == 2:
        print('Você ganhou')
    elif jogador == 3:
        print('Você perdeu')

elif computador == 2:
    if jogador == 1:
        print('Você perdeu')
    elif jogador == 2:
    elif jogador == 3:
        print('Você ganhou')

elif computador == 3:
    if jogador == 1:
        print('Você ganhou')
    elif jogador == 2:
        print('Você perdeu')
    elif jogador == 3:

File system – access to the "downloads" folder in internal memory

I can view files in the downloads folder in the internal memory of my LG V35 ThinQ phone.
I can not see these files on my Windows PC (phone connected to PC in USB storage mode).
When I try to move the files to a folder on my SD card using the Move command on the phone, the Move command works normally, but the files are simply hidden.
How can I access these files using the phone or my PC to get a copy of it?
My phone is not rooted and I do not want to root it.
Thank you so much!

Javascript – Create a simple leaderboard in memory

I try to think about the most efficient way to structure a leaderboard in memory with the ability to quickly read a given rank. I'm talking about very small optimizations because either way they're still fast.

class Leaderboard
        this.leaderboard = ();

    insert(name, score)
        const player = new Player(name, score, new Date());
        this.leaderboard.sort((a, b) => a.score - b.score);

        if (isNaN(rank) || rank < 1 || rank > this.leaderboard.length) return null;
        return this.leaderboard(rank - 1);

class Player
    constructor(name, score, date)
    { = name;
        this.score = score; = date;

const leaderboard = new Leaderboard();

leaderboard.insert('john', 36);
leaderboard.insert('pete', 23);
leaderboard.insert('dave', 56);


I've come up with that, every feedback is great, and little tweaking or totally different and better ways are welcome, thanks

How do I replace an SD card formatted as internal memory?

I need help..

I have a Redmi 4a device, with Android 7,
I have formatted a 64 GB ADATA SD card as internal storage and it works a long time until after a reboot the SD card is corrupted with valuable data.

It's called to format, but it's not formatted. I tried it with my laptop and Windows CD and Easeus partition manager, but none worked.

I've lost hope to repair the SD card, but the phone does not accept photos or store data, even if the new card is identical to the old one.
When I try to show a photo status on WhatsApp, I can not download because there is no internal memory available, please hang it as a drive and try again.
In addition, I can not see a picture that was sent to me in the chat.

I tried to format the new card as internal, but the same problem ..

Any help?

Memory – S6: Folder is empty when attempting to display the files on the PC, display is defective

As a result, my phone's screen has recently turned off, and trying to display it on my PC leaves an empty folder.
The phone is still on and running, only the display is broken
There are several solutions for this, which I link below:

The folder "Galaxy S6" is empty on the PC

There must be a way to use the phone from my PC, right?

Would be glad if someone could help me

Linux – Apache 2.4 consumes too little memory

I have a weird problem with Apache. It seems that it uses too little memory. My average Apache process size is 17 MB and I checked between 20:00 and 20:05. I have 483 connections to the server. As far as I know, Apache needs a worker for every request / connection, so it needs 483 * 17 MB of RAM. That's over 8GB. What surprised me, it only consumed 200MB.


  ServerLimit 520
  MaxRequestWorkers 500
  MaxConnectionsPerChild 50


ss -ant | grep :443 | wc –l

Average Apache process size:

ps -ylC httpd | awk '{x += $8;y += 1} END {print "Apache Memory Usage (MB): "x/1024; print "Average Proccess Size (MB): "x/((y-1)*1024)}'
17 MB

CPU statistics from sar:

08:00:01 PM     CPU     %user     %nice   %system   %iowait    %steal     %idle
08:00:01 PM     all     11.4%      0.0%      2.1%      0.1%      0.0%     86.5%
08:05:01 PM     all     41.2%      0.0%      5.8%      0.8%      0.0%     52.3%
08:10:00 PM     all     14.6%      0.0%      3.0%      0.3%      0.0%     82.1%
08:10:01 PM     all     12.8%      0.0%      2.3%      0.0%      0.0%     84.9%
08:15:01 PM     all      7.7%      0.0%      1.8%      0.1%      0.0%     90.4%

RAM stats from sar

08:00:01 PM kbmemfree   kbavail kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit  kbactive   kbinact   kbdirty
08:00:01 PM     12.7G     13.1G      1.8G     12.3%      4.1M    592.8M      5.3G     36.8%      1.3G    272.1M     20.0M
08:05:01 PM     12.5G     12.9G      2.0G     13.7%      4.1M    639.5M      5.6G     38.3%      1.4G    306.6M     10.8M
08:10:00 PM     12.5G     12.9G      2.0G     13.9%      4.1M    668.7M      5.6G     38.3%      1.4G    326.6M      8.8M

Extreme memory consumption when exporting to ExpressionML

I have a big variable, datathat is (roughly) a large list of polynomials in x with numerical coefficients with high accuracy (say SetPrecision(coeff,200)). If I dumpe this variable with


I get a file with a size of about 24 MB. I need data be exported to an XML with

Export("fname.xml",data, "ExpressionML")

to have the right format for it to be used by an external program. The problem is that to export data For XML, Mathematica uses more than 4 GB (!) Of RAM. I find that very exaggerated, as I would assume that the memory was in the order of memory .mx File, not thousands more order.

Since the machine we use does not have too much memory, we first had to dump data to a mx File at the bottom of our script so that we can free up the memory, and then open a new script whose sole purpose is to load that mx and export it xml,

The only "non-standard" format of data If that is what the external program should use, we need to name the elements of the list in a practical way, namely:

data= { Matrix(Prefactor(a,b,c), {pol1, pol2,...}, ...}

Where a,b,c are numbers and pol1, ... Polynomials in xso that the resulting XML has the correct tags for the external program.

Is this huge amount of RAM expected and, if so, is there a way to reduce it?