[Trilinos-Users] Aztec memory problem

Carlos Reyes carlos at stellarscience.com
Thu Jul 7 10:23:47 EDT 2016


The only safe type to use for memory sizes is std::size_t. Casting from 
an unsigned int to a size_t should be safe. It sounds like the problem 
could be fixed by making internal changes to AZ_memory_manage and not to 
1181 call sites. I would imagine that modifying AZ_memory_manage to use 
a size_t instead of a long int internally is not too hard.

*Carlos Reyes*
1-505-206-1569 (mobile)
Look ma, no APIs! /https://youtu.be/mhiYYmWh5b4/

On 07/07/2016 08:14 AM, Chris Jackson wrote:
>
> Hi all, we found a problem in AZ_manage_memory.  This function takes 
> an *unsigned int* in argument for the *size* of memory we want to 
> allocate. The first thing  it does  is to cast this value to a *long 
> int*, then it does some arithmetic on this value.  After, it calls 
> AZ_allocate (malloc in disguise) by casting the *long int *size to 
> *unsigned int *and tries to access the *long int * size index in the 
> allocated array.  When we ask for 3GB of ram we get a negative index.
>
> Modifying it to use a 64 bit type means going through 1181 calls to 
> this function and modify all memory size arithmetic to be done with 
> the same type.
>
> Suggestions?  Comments?
>
> Thanks
>
> Chris Jackson
>
>
>
> _______________________________________________
> Trilinos-Users mailing list
> Trilinos-Users at trilinos.org
> https://trilinos.org/mailman/listinfo/trilinos-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://trilinos.org/pipermail/trilinos-users/attachments/20160707/08ac405e/attachment.html>


More information about the Trilinos-Users mailing list