Re: [gdal-dev] Allocate large memory space with CPLMalloc(). Bug or not?

2015-10-01 Thread fazotron
Thanks for reply, I'll try VSIMalloc(). But can you explain the goal of check if( long(nSize) < 0 ) {...} in CPLMalloc()? Cast size_t to long leads to implicit result. -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Allocate-large-memory-space-with-CPLMalloc-Bug-or-not-tp52

Re: [gdal-dev] Allocate large memory space with CPLMalloc(). Bug or not?

2015-10-01 Thread fazotron
Thanks for reply, I'll try VSIMalloc(). But can you explain the goal of check *if( long(nSize) < 0 ) {...}* in CPLMalloc()? Cast size_t to long leads to implicit result. -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Allocate-large-memory-space-with-CPLMalloc-Bug-or-not-tp

[gdal-dev] Allocate large memory space with CPLMalloc(). Bug or not?

2015-10-01 Thread fazotron
Hello! Take a look on the following code: *... size_t w = 1, h = 5000, d = 150; size_t sz = w * h * d * sizeof(float); // ~27.94 Gb float *volume = (float*)CPLMalloc(sz); ...* In this case GDAL throws error in runtime: "ERROR 1: CPLMalloc(-664771072): Silly size requested." But I think that