[IPOL discuss] [IPOL tech] Swap memory

Gabriele Facciolo gfacciol at gmail.com
Sun Oct 23 19:08:07 CEST 2011


Hi Miguel,
in a desktop computer you can have as much swap as you want all you
need is a partition. But on a server, the swap should not be used. And
the reason for that is because Random Accessing swapped Memory can
easily render the system unresponsive or even lock it, and that's bad
karma on a multi-user system.

By the way, fuchsia has 6 Gb of RAM, and 3 Gb of swap. Let's say the
algorithm uses the full 3Gb of swap, just writing and reading 3Gb from
the disk will take more than 30 seconds (that's no longer On Line).
In conclusion I'll consider resizing the input, or rethinking the
algorithm to reduce its memory footprint.

Best,
Gabriele

On Sun, Oct 23, 2011 at 6:09 PM, Miguel Colom
<Miguel.Colom at cmla.ens-cachan.fr> wrote:
> Hello all,
> these days Marc Lebrun and I have been trying to find the cause of a
> memory bug in some denoising programs.
>
> These programs work properly in Marc's machine, but they fail on mine and
> also on the IPOL server.
>
> Finally we managed to find the cause of the problem. The programs allocate
> a lot of memory and when it runs out of a certain amount, "malloc" returns
> a NULL or a std::bad_alloc exception is raised by the "new" operator.
>
> In Marc's computer the program isn't crashing because when the available
> amount of free memory is low, it starts to use swap memory.
>
> In my computer, when the memory is low, the swap isn't used and the
> program fails to get more memory because the system isn't using swap.
>
> Does anyone know the cause why the system isn't using swap or how to
> configure it to change this behavior?
>
> Best,
> Miguel
>
> PS: to check if the swap is activated, you can use this command: sudo swap -s
>
> Filename                                Type            Size    Used    Priority
> /dev/sda1                               partition       5858300 200092  -1
>
> In my case, it is.
>
> PPS: to see the memory used by the process, you can use gnome-system-monitor
> . The following code portions can be used to make the process use lots of
> memory:
>
>    // MALLOC
>    int i = 0;
>    double *data;
>    do {
>      cout << i << endl;
>      data = (double*)malloc(1024 * 1024 * sizeof(double));
>      i++;
>    } while (data != NULL);
>
> ---
>    // NEW
>    int i = 0;
>    do {
>      cout << i << endl;
>      float *data = new float[1024 * 1024];
>      i++;
>    } while (true);
>
>
> _______________________________________________
> tech mailing list
> tech at list.ipol.im
> http://tools.ipol.im/mailman/listinfo/tech
>
_______________________________________________
tech mailing list
tech at list.ipol.im
http://tools.ipol.im/mailman/listinfo/tech



More information about the discuss mailing list