Closed joa-quim closed 2 years ago
Plotting geographic with linear is always odd. I suspect on the CLI front we know the data is geographic and that sets basically -fg under the hood. Please try to add -fg (or use -JX10d/0 or something to tell it) to see if that is the case. But you also say -JQ which definitively should set -fg...
Adding -fg
makes no difference. I tried -JQ
, even changed central meridian, to test it too.
Will try to debug later today.
OK, migrated all my stuff from Mac Mini to new MacBook pro laptop. Julia on mac ports for M1 still screwed so using the alternate direct install. Can reproduce the problem. I noticed these too:
G = gmtread("@earth_relief_05m");
GMT [WARNING]: Max total memory allocated was 35.792 Mb [37530568 bytes]
GMT [WARNING]: Single largest allocation was 35.596 Mb [37324800 bytes]
GMT [WARNING]: MEMORY NOT FREED: 0.062 kb [64 bytes]
GMT [WARNING]: Items allocated: 247 reallocated: 134 freed: 245
GMT [WARNING]: Items NOT PROPERLY FREED: 2
GMT [WARNING]: Memory not freed first allocated in gmt_parse.c:955(GMT_Make_Option) (ID = 8): 0.031 kb [32 bytes]
GMT [WARNING]: Memory not freed first allocated in gmt_parse.c:955(GMT_Make_Option) (ID = 9): 0.031 kb [32 bytes]
Added stop points in Xcode and it all works fine - no sluggishness or spinning wheels. Will see what I learn.
Found an issue. Testing the fix.
I cannot get to the memory with ID 8 since it seems it was allocated by GMT_Create_Session and I cannot get a stop in that function. Does "using GMT" start a session?
OK, got there. I see using GMT
is processing some options and those are not freed when the gmtread ends, hence a memory leak. Probably up to @joa-quim to fix that.
Julia on mac ports for M1 still screwed so using the alternate direct install.
Always use the Julia binaries provided in the Julialang site. Still want me to fix any mem leak? Julia starts a session that lasts ... till we kill it.
No big deal, but it seems gmtread ends a session (?) and therefore complains about unfreed memory. It is a bit odd.
Some modules still leave the session in a non-cleaned state. So when I find one such situation I delete the session at the end ant a new one will be created when needed. gmtread
also creates a second session but, in principle, only when reading an ogr file, but maybe there is an indirect recreation in the middle that I'm not seeing right now
# Because of the certificates shits on Windows. But for some reason the set in gmtlib_check_url_name() is not visible
(Sys.iswindows()) && run(`cmd /c set GDAL_HTTP_UNSAFESSL=YES`)
API2 = GMT_Create_Session("GMT", 2, GMT_SESSION_NOEXIT + GMT_SESSION_EXTERNAL + GMT_SESSION_NOGDALCLOSE + GMT_SESSION_COLMAJOR);
...
GMT_Destroy_Session(API2)
Seems that will lead to some memory leaks. You can see them if you compile GMT with the -DDEBUG and -DMEM_DEBUG options (see the advanced Cmake file).
It's -DMEMDEBUG and I do build with them but don't see those warnings!
Hah, that is odd. I got it both when just running the Julia commands in the terminal as well as when hooked to Xcode.
This came out in the forum post and it doesn't look like a Julia bug. See, it screws with linear projections (including Plate Carre) but works well for true projections (Mercator in this example). Note that plotting directly from the file (i.e. without loading it first) also works well.