[MINC-users] MINC-users Digest, Vol 91, Issue 2
Thomas Funck
thomas.funck at mail.mcgill.ca
Mon Feb 4 12:46:16 EST 2013
Hi again,
Second question of the day. I want to read in the frame lengths from a minc file and I've been trying to use "miget_attr_values" but without much success. I can get it to work with attributes that fall under the "variables:" category (e.g., study:start_hour), but not with "time" in "data:". Am I using the wrong function or the wrong path? Thanks again for the help.
Thomas
________________________________________
From: minc-users-bounces at bic.mni.mcgill.ca [minc-users-bounces at bic.mni.mcgill.ca] on behalf of minc-users-request at bic.mni.mcgill.ca [minc-users-request at bic.mni.mcgill.ca]
Sent: Monday, February 04, 2013 12:00 PM
To: minc-users at bic.mni.mcgill.ca
Subject: MINC-users Digest, Vol 91, Issue 2
Send MINC-users mailing list submissions to
minc-users at bic.mni.mcgill.ca
To subscribe or unsubscribe via the World Wide Web, visit
http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users
or, via email, send a message with subject or body 'help' to
minc-users-request at bic.mni.mcgill.ca
You can reach the person managing the list at
minc-users-owner at bic.mni.mcgill.ca
When replying, please edit your Subject line so it is more specific
than "Re: Contents of MINC-users digest..."
Today's Topics:
1. Memory Leak when using miopen_volume (Thomas Funck)
2. Re: Memory Leak when using miopen_volume (Vladimir S. FONOV)
----------------------------------------------------------------------
Message: 1
Date: Mon, 4 Feb 2013 15:56:03 +0000
From: Thomas Funck <thomas.funck at mail.mcgill.ca>
To: "minc-users at bic.mni.mcgill.ca" <minc-users at bic.mni.mcgill.ca>
Subject: [MINC-users] Memory Leak when using miopen_volume
Message-ID:
<53F3FD0032C9CC4BA836E8F0FC2890650D6084 at EXMBX2010-4.campus.MCGILL.CA>
Content-Type: text/plain; charset="us-ascii"
Hi,
I'm getting all sorts of crazy errors (e.g. malloc returning true when it hasn't actually allocated any memory) when trying to run a program I wrote using the minc2 library. I suspect that the errors may be due to memory leaks which I encounter when using miopen_volume and then close the volume with miclose_volume. Running valgrind, I get the following errors. I'm compiling and running my code on the bic server. Is this normal or have I made a mistake in my code?
Many thanks for any help!
Best,
Thomas
==32603== Memcheck, a memory error detector
==32603== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==32603== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for copyright info
==32603== Command: ./pet -nosmooth -lp 0.15 test.mnc test_brainmask.mnc test_brainmask.mnc 30
==32603==
==32603== Conditional jump or move depends on uninitialised value(s)
==32603== at 0x41A349: miopen_volume (volume.c:885)
==32603== by 0x40463D: getdimensions (pet_input.c:183)
==32603== by 0x4057F1: processImage (pet_core.c:50)
==32603== by 0x4062E6: main (pet_core.c:388)
==32603== Uninitialised value was created by a stack allocation
==32603== at 0x41A27D: miopen_volume (volume.c:1047)
==32603==
==32603== Conditional jump or move depends on uninitialised value(s)
==32603== at 0x41A34B: miopen_volume (volume.c:885)
==32603== by 0x40463D: getdimensions (pet_input.c:183)
==32603== by 0x4057F1: processImage (pet_core.c:50)
==32603== by 0x4062E6: main (pet_core.c:388)
==32603== Uninitialised value was created by a stack allocation
==32603== at 0x41A27D: miopen_volume (volume.c:1047)
==32603==
==32603== Conditional jump or move depends on uninitialised value(s)
==32603== at 0x41A7C5: miopen_volume (volume.c:888)
==32603== by 0x40463D: getdimensions (pet_input.c:183)
==32603== by 0x4057F1: processImage (pet_core.c:50)
==32603== by 0x4062E6: main (pet_core.c:388)
==32603== Uninitialised value was created by a stack allocation
==32603== at 0x41A27D: miopen_volume (volume.c:1047)
==32603==
==32603== Conditional jump or move depends on uninitialised value(s)
==32603== at 0x41A7C7: miopen_volume (volume.c:888)
==32603== by 0x40463D: getdimensions (pet_input.c:183)
==32603== by 0x4057F1: processImage (pet_core.c:50)
==32603== by 0x4062E6: main (pet_core.c:388)
==32603== Uninitialised value was created by a stack allocation
==32603== at 0x41A27D: miopen_volume (volume.c:1047)
==32603==
==32603== Conditional jump or move depends on uninitialised value(s)
==32603== at 0x41AB7E: miopen_volume (volume.c:891)
==32603== by 0x40463D: getdimensions (pet_input.c:183)
==32603== by 0x4057F1: processImage (pet_core.c:50)
==32603== by 0x4062E6: main (pet_core.c:388)
==32603== Uninitialised value was created by a stack allocation
==32603== at 0x41A27D: miopen_volume (volume.c:1047)
==32603==
==32603== Conditional jump or move depends on uninitialised value(s)
==32603== at 0x41AB80: miopen_volume (volume.c:891)
==32603== by 0x40463D: getdimensions (pet_input.c:183)
==32603== by 0x4057F1: processImage (pet_core.c:50)
==32603== by 0x4062E6: main (pet_core.c:388)
==32603== Uninitialised value was created by a stack allocation
==32603== at 0x41A27D: miopen_volume (volume.c:1047)
==32603==
==32603== Conditional jump or move depends on uninitialised value(s)
==32603== at 0x41ABE5: miopen_volume (volume.c:894)
==32603== by 0x40463D: getdimensions (pet_input.c:183)
==32603== by 0x4057F1: processImage (pet_core.c:50)
==32603== by 0x4062E6: main (pet_core.c:388)
==32603== Uninitialised value was created by a stack allocation
==32603== at 0x41A27D: miopen_volume (volume.c:1047)
==32603==
File test.mnc has dimensions 9 47 128 128.
Average separations: t=1.000000, z=-3.125000 y=2.202420 x=2.202420
Starts: 0.000000 -348.909988 -139.853657 -139.853657
==32603==
==32603== HEAP SUMMARY:
==32603== in use at exit: 1,067 bytes in 28 blocks
==32603== total heap usage: 3,999 allocs, 3,971 frees, 1,075,894 bytes allocated
==32603==
==32603== 128 bytes in 4 blocks are definitely lost in loss record 3 of 7
==32603== at 0x4C244E8: malloc (vg_replace_malloc.c:236)
==32603== by 0x416A4B: alloc2d (m2util.c:1709)
==32603== by 0x416FFE: miinvert_transform (m2util.c:1925)
==32603== by 0x41A975: miopen_volume (volume.c:1142)
==32603== by 0x40463D: getdimensions (pet_input.c:183)
==32603== by 0x4057F1: processImage (pet_core.c:50)
==32603== by 0x4062E6: main (pet_core.c:388)
==32603==
==32603== 128 bytes in 4 blocks are definitely lost in loss record 4 of 7
==32603== at 0x4C244E8: malloc (vg_replace_malloc.c:236)
==32603== by 0x416A4B: alloc2d (m2util.c:1709)
==32603== by 0x417010: miinvert_transform (m2util.c:1926)
==32603== by 0x41A975: miopen_volume (volume.c:1142)
==32603== by 0x40463D: getdimensions (pet_input.c:183)
==32603== by 0x4057F1: processImage (pet_core.c:50)
==32603== by 0x4062E6: main (pet_core.c:388)
==32603==
==32603== 128 bytes in 4 blocks are definitely lost in loss record 5 of 7
==32603== at 0x4C244E8: malloc (vg_replace_malloc.c:236)
==32603== by 0x416A4B: alloc2d (m2util.c:1709)
==32603== by 0x416ED9: scaled_maximal_pivoting_gaussian_elimination_real (m2util.c:1885)
==32603== by 0x41707F: miinvert_transform (m2util.c:1937)
==32603== by 0x41A975: miopen_volume (volume.c:1142)
==32603== by 0x40463D: getdimensions (pet_input.c:183)
==32603== by 0x4057F1: processImage (pet_core.c:50)
==32603== by 0x4062E6: main (pet_core.c:388)
==32603==
==32603== 128 bytes in 4 blocks are definitely lost in loss record 6 of 7
==32603== at 0x4C244E8: malloc (vg_replace_malloc.c:236)
==32603== by 0x416A4B: alloc2d (m2util.c:1709)
==32603== by 0x416EE5: scaled_maximal_pivoting_gaussian_elimination_real (m2util.c:1886)
==32603== by 0x41707F: miinvert_transform (m2util.c:1937)
==32603== by 0x41A975: miopen_volume (volume.c:1142)
==32603== by 0x40463D: getdimensions (pet_input.c:183)
==32603== by 0x4057F1: processImage (pet_core.c:50)
==32603== by 0x4062E6: main (pet_core.c:388)
==32603==
==32603== LEAK SUMMARY:
==32603== definitely lost: 512 bytes in 16 blocks
==32603== indirectly lost: 0 bytes in 0 blocks
==32603== possibly lost: 0 bytes in 0 blocks
==32603== still reachable: 555 bytes in 12 blocks
==32603== suppressed: 0 bytes in 0 blocks
==32603== Reachable blocks (those to which a pointer was found) are not shown.
==32603== To see them, rerun with: --leak-check=full --show-reachable=yes
==32603==
==32603== For counts of detected and suppressed errors, rerun with: -v
==32603== ERROR SUMMARY: 11 errors from 11 contexts (suppressed: 4 from 4)
------------------------------
Message: 2
Date: Mon, 4 Feb 2013 11:04:02 -0500
From: "Vladimir S. FONOV" <vladimir.fonov at gmail.com>
To: MINC users mailing list <minc-users at bic.mni.mcgill.ca>
Subject: Re: [MINC-users] Memory Leak when using miopen_volume
Message-ID:
<CAMCwi7N3enHnrbGOo6w=N-_H=j+AUpbo0FWZPfpzm0WwvtK8Yg at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Hello,
I think I fixed this memory leak in the experimental development
version of libminc ( https://github.com/BIC-MNI/libminc/tree/minc_lite
- note the branch name)
On Mon, Feb 4, 2013 at 10:56 AM, Thomas Funck
<thomas.funck at mail.mcgill.ca> wrote:
> Hi,
>
> I'm getting all sorts of crazy errors (e.g. malloc returning true when it hasn't actually allocated any memory) when trying to run a program I wrote using the minc2 library. I suspect that the errors may be due to memory leaks which I encounter when using miopen_volume and then close the volume with miclose_volume. Running valgrind, I get the following errors. I'm compiling and running my code on the bic server. Is this normal or have I made a mistake in my code?
>
> Many thanks for any help!
>
> Best,
>
> Thomas
>
> ==32603== Memcheck, a memory error detector
> ==32603== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
> ==32603== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for copyright info
> ==32603== Command: ./pet -nosmooth -lp 0.15 test.mnc test_brainmask.mnc test_brainmask.mnc 30
> ==32603==
> ==32603== Conditional jump or move depends on uninitialised value(s)
> ==32603== at 0x41A349: miopen_volume (volume.c:885)
> ==32603== by 0x40463D: getdimensions (pet_input.c:183)
> ==32603== by 0x4057F1: processImage (pet_core.c:50)
> ==32603== by 0x4062E6: main (pet_core.c:388)
> ==32603== Uninitialised value was created by a stack allocation
> ==32603== at 0x41A27D: miopen_volume (volume.c:1047)
> ==32603==
> ==32603== Conditional jump or move depends on uninitialised value(s)
> ==32603== at 0x41A34B: miopen_volume (volume.c:885)
> ==32603== by 0x40463D: getdimensions (pet_input.c:183)
> ==32603== by 0x4057F1: processImage (pet_core.c:50)
> ==32603== by 0x4062E6: main (pet_core.c:388)
> ==32603== Uninitialised value was created by a stack allocation
> ==32603== at 0x41A27D: miopen_volume (volume.c:1047)
> ==32603==
> ==32603== Conditional jump or move depends on uninitialised value(s)
> ==32603== at 0x41A7C5: miopen_volume (volume.c:888)
> ==32603== by 0x40463D: getdimensions (pet_input.c:183)
> ==32603== by 0x4057F1: processImage (pet_core.c:50)
> ==32603== by 0x4062E6: main (pet_core.c:388)
> ==32603== Uninitialised value was created by a stack allocation
> ==32603== at 0x41A27D: miopen_volume (volume.c:1047)
> ==32603==
> ==32603== Conditional jump or move depends on uninitialised value(s)
> ==32603== at 0x41A7C7: miopen_volume (volume.c:888)
> ==32603== by 0x40463D: getdimensions (pet_input.c:183)
> ==32603== by 0x4057F1: processImage (pet_core.c:50)
> ==32603== by 0x4062E6: main (pet_core.c:388)
> ==32603== Uninitialised value was created by a stack allocation
> ==32603== at 0x41A27D: miopen_volume (volume.c:1047)
> ==32603==
> ==32603== Conditional jump or move depends on uninitialised value(s)
> ==32603== at 0x41AB7E: miopen_volume (volume.c:891)
> ==32603== by 0x40463D: getdimensions (pet_input.c:183)
> ==32603== by 0x4057F1: processImage (pet_core.c:50)
> ==32603== by 0x4062E6: main (pet_core.c:388)
> ==32603== Uninitialised value was created by a stack allocation
> ==32603== at 0x41A27D: miopen_volume (volume.c:1047)
> ==32603==
> ==32603== Conditional jump or move depends on uninitialised value(s)
> ==32603== at 0x41AB80: miopen_volume (volume.c:891)
> ==32603== by 0x40463D: getdimensions (pet_input.c:183)
> ==32603== by 0x4057F1: processImage (pet_core.c:50)
> ==32603== by 0x4062E6: main (pet_core.c:388)
> ==32603== Uninitialised value was created by a stack allocation
> ==32603== at 0x41A27D: miopen_volume (volume.c:1047)
> ==32603==
> ==32603== Conditional jump or move depends on uninitialised value(s)
> ==32603== at 0x41ABE5: miopen_volume (volume.c:894)
> ==32603== by 0x40463D: getdimensions (pet_input.c:183)
> ==32603== by 0x4057F1: processImage (pet_core.c:50)
> ==32603== by 0x4062E6: main (pet_core.c:388)
> ==32603== Uninitialised value was created by a stack allocation
> ==32603== at 0x41A27D: miopen_volume (volume.c:1047)
> ==32603==
> File test.mnc has dimensions 9 47 128 128.
> Average separations: t=1.000000, z=-3.125000 y=2.202420 x=2.202420
> Starts: 0.000000 -348.909988 -139.853657 -139.853657
> ==32603==
> ==32603== HEAP SUMMARY:
> ==32603== in use at exit: 1,067 bytes in 28 blocks
> ==32603== total heap usage: 3,999 allocs, 3,971 frees, 1,075,894 bytes allocated
> ==32603==
> ==32603== 128 bytes in 4 blocks are definitely lost in loss record 3 of 7
> ==32603== at 0x4C244E8: malloc (vg_replace_malloc.c:236)
> ==32603== by 0x416A4B: alloc2d (m2util.c:1709)
> ==32603== by 0x416FFE: miinvert_transform (m2util.c:1925)
> ==32603== by 0x41A975: miopen_volume (volume.c:1142)
> ==32603== by 0x40463D: getdimensions (pet_input.c:183)
> ==32603== by 0x4057F1: processImage (pet_core.c:50)
> ==32603== by 0x4062E6: main (pet_core.c:388)
> ==32603==
> ==32603== 128 bytes in 4 blocks are definitely lost in loss record 4 of 7
> ==32603== at 0x4C244E8: malloc (vg_replace_malloc.c:236)
> ==32603== by 0x416A4B: alloc2d (m2util.c:1709)
> ==32603== by 0x417010: miinvert_transform (m2util.c:1926)
> ==32603== by 0x41A975: miopen_volume (volume.c:1142)
> ==32603== by 0x40463D: getdimensions (pet_input.c:183)
> ==32603== by 0x4057F1: processImage (pet_core.c:50)
> ==32603== by 0x4062E6: main (pet_core.c:388)
> ==32603==
> ==32603== 128 bytes in 4 blocks are definitely lost in loss record 5 of 7
> ==32603== at 0x4C244E8: malloc (vg_replace_malloc.c:236)
> ==32603== by 0x416A4B: alloc2d (m2util.c:1709)
> ==32603== by 0x416ED9: scaled_maximal_pivoting_gaussian_elimination_real (m2util.c:1885)
> ==32603== by 0x41707F: miinvert_transform (m2util.c:1937)
> ==32603== by 0x41A975: miopen_volume (volume.c:1142)
> ==32603== by 0x40463D: getdimensions (pet_input.c:183)
> ==32603== by 0x4057F1: processImage (pet_core.c:50)
> ==32603== by 0x4062E6: main (pet_core.c:388)
> ==32603==
> ==32603== 128 bytes in 4 blocks are definitely lost in loss record 6 of 7
> ==32603== at 0x4C244E8: malloc (vg_replace_malloc.c:236)
> ==32603== by 0x416A4B: alloc2d (m2util.c:1709)
> ==32603== by 0x416EE5: scaled_maximal_pivoting_gaussian_elimination_real (m2util.c:1886)
> ==32603== by 0x41707F: miinvert_transform (m2util.c:1937)
> ==32603== by 0x41A975: miopen_volume (volume.c:1142)
> ==32603== by 0x40463D: getdimensions (pet_input.c:183)
> ==32603== by 0x4057F1: processImage (pet_core.c:50)
> ==32603== by 0x4062E6: main (pet_core.c:388)
> ==32603==
> ==32603== LEAK SUMMARY:
> ==32603== definitely lost: 512 bytes in 16 blocks
> ==32603== indirectly lost: 0 bytes in 0 blocks
> ==32603== possibly lost: 0 bytes in 0 blocks
> ==32603== still reachable: 555 bytes in 12 blocks
> ==32603== suppressed: 0 bytes in 0 blocks
> ==32603== Reachable blocks (those to which a pointer was found) are not shown.
> ==32603== To see them, rerun with: --leak-check=full --show-reachable=yes
> ==32603==
> ==32603== For counts of detected and suppressed errors, rerun with: -v
> ==32603== ERROR SUMMARY: 11 errors from 11 contexts (suppressed: 4 from 4)
> _______________________________________________
> MINC-users at bic.mni.mcgill.ca
> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users
--
Best regards,
Vladimir S. Fonov ~ vladimir <dot> fonov <at> gmail <dot> com
------------------------------
_______________________________________________
MINC-users mailing list
MINC-users at bic.mni.mcgill.ca
http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users
End of MINC-users Digest, Vol 91, Issue 2
*****************************************
More information about the MINC-users
mailing list