From @oko| @end|ng |rom |n@@-tou|ou@e@|r  Wed Jun  9 12:08:34 2021
From: @oko| @end|ng |rom |n@@-tou|ou@e@|r (Serguei Sokol)
Date: Wed, 9 Jun 2021 12:08:34 +0200
Subject: [Rd] dgTMatrix Segmentation Fault
In-Reply-To: <24767.39822.987117.724657@stat.math.ethz.ch>
References: <SYBPR01MB4761C684F1CA43CA4945FA25CD389@SYBPR01MB4761.ausprd01.prod.outlook.com>
 <91d30364-998a-c783-b9c5-9b05405d30b2@insa-toulouse.fr>
 <SYBPR01MB4761A3436511885B1346831ACD379@SYBPR01MB4761.ausprd01.prod.outlook.com>
 <24767.39822.987117.724657@stat.math.ethz.ch>
Message-ID: <661d72aa-655e-68ac-edfe-e37e9d39c6b8@insa-toulouse.fr>

Le 08/06/2021 ? 18:32, Martin Maechler a ?crit?:
>>>>>> Dario Strbenac
>>>>>>      on Tue, 8 Jun 2021 09:00:04 +0000 writes:
>      > Good day, Indeed, changing the logical test is a
>      > workaround to the problem. However, a segmentation fault
>      > means that the software tried to access an invalid memory
>      > location, so I think the original problem should be
>      > addressed in Matrix package, regardless.
>
> Hmm, you maybe right or not ..
>
> Note we have the situation you (via R) ask your computer
> (i.e. the OS system memory allocation routines) to provide
> memory.
>
> In a reasonable setup, the OS routine returns, saying
> "I cannot provide the memory you asked for",
> and the R function stop() s. .. no segfault, all is fine.
>
> The problem that on some platforms that does not work, is a
> relatively deep problem  and also has happened in base R in some
> cases on some platforms (possibly never on Linux based ones
> (Ubuntu, Debian, Fedora, CentOS..),  but maybe I'm too
> optimistic there as well.
>
> Note: I now also tried on our oldish Windows (Terminal) Server,
> and it also just gave errors that it could not allocate so much
> memory but did not produce a seg.fault.
>
>
> Currently, I don't see what we should improve in the Matrix
> package here.
Is it possible (pure hypothesis) that when such a big piece of memory is 
available, some int32 counter is out of bounds?
Here, we have almost 1.e10 non-zero elements. This number is greater 
than 2**31-1 (int32 limit) and even greater than unit32 limit (2**32).
Just a thought.

Best,
Serguei.

>
> Martin Maechler
> (co-maintainer of 'Matrix')
>
>      > --------------------------------------
>      > Dario Strbenac University of Sydney Camperdown NSW 2050
>      > Australia
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] dgTMatrix Segmentation Fault
Serguei Sokol