09-30-2002
Re: problem deallocating memory for 3d aray
I think I have got the answer.
The deallocate function is right. There is a problem in the allocate function.
When you allocate memory to 'tensor', you use:
tensor = (double***)malloc(sizeof(double**)*n);
that is to say, you just can access tensor through 0 to n. If you want to access tensor[i] which i > n , then a problem will arise.
That's the reason why it works when number < n and doesn't work when number > n.
By the way, I think there is a simple way to allocate a block of memory to the big array such as 'tensor'.
allocate:
tensor = (double***)malloc(sizeof(double)*number*number*n);
deallocate:
free(tensor);
Hope it be helpful.
10 More Discussions You Might Find Interesting
1. Programming
Hi:
I have a server with a very little memory leak (29 bytes) as reported by Purify.
Itīs a pooled server, so each process lives forever accepting conections.But top or ps commands show that used memory it is always increasing much more than 29 bytes (30K mor or less) in each conection.
How... (0 Replies)
Discussion started by: Pablo J. Royo
0 Replies
2. Programming
Hi ,
One of java programs in our machine allocates 256M of heap memory and max of 512 memory(Tomcat to be specific).
Our ulimit per process is 32M.How can a process allocates such a big amount of memory
ps v output is
PGIN SIZE RSS LIM TSIZ TRS %CPU %MEM COMMAND
... (0 Replies)
Discussion started by: ganti
0 Replies
3. Filesystems, Disks and Memory
Hi ,
One of java programs in our machine allocates 256M of heap memory and max of 512 memory(Tomcat to be specific).
Our ulimit per process is 32M.How can a process allocates such a big amount of memory
ps v output is
PGIN SIZE RSS LIM TSIZ TRS %CPU %MEM COMMAND
24 220776 220892... (0 Replies)
Discussion started by: ganti
0 Replies
4. Programming
Hi, I am writing a C program under SCO Unix. I have a memory stack problem but do not know how to go about fixing it. I have tried running INSURE but that does not detect any problems.
Essentially the problem is that the memory address shifts on return from a routine. I pass a pointer to... (3 Replies)
Discussion started by: jkeagy
3 Replies
5. Programming
Hi, I try to marshal a unsigned int and a char * into a buffer, and then unmarshal them later to get them out. I need to put the char * in the front and unsigned int at the end of the buffer. However, my system always give me "BUS ERROR". I am using Sun Sparcs Sloris 2.10.
My code to marshal... (6 Replies)
Discussion started by: nj302
6 Replies
6. Solaris
i am building open source software on a solaris 8 machine
for couple of days i am getting error messages like
out of memory
or
no more processes and then build is failing
i tried with rebooting the machine but then after couple of days same problem is arising again.
can any one... (1 Reply)
Discussion started by: mobydick
1 Replies
7. Programming
hi all
Can any one plz explain me about memory leak problem
Thankx (5 Replies)
Discussion started by: sonali
5 Replies
8. Red Hat
Hi, I have a Linux distribution ( Oralce Enterprise Linux 5.3 i.e. Redhat ) that I have installed. It works fine when I used 2*512Mb dimms or replace them with a single 1Gb dimm. However when I try to go above 1 Gb the bootup and general performance deteriorates badly. The BIOS picks up the memory... (3 Replies)
Discussion started by: jimthompson
3 Replies
9. Programming
Hi,
I'm looking for a quite "interesting" bug at the moment - any idea could help! (o;
Language is fortran 90, compiler gfortran (sry, dont find which version it is). As I suppose you dont want to read like 10k lines of code here, I won't post the entire thing ^^
The problem is that I get... (3 Replies)
Discussion started by: Giogio
3 Replies
10. Programming
I'm having a hard time figuring out how to manage deallocation of memory in multithreaded environments. Specifically what I'm having a hard time with is using a lock to protect a structure, but when it's time to free the structure, you have to unlock the lock to destroy the lock itself. Which will... (5 Replies)
Discussion started by: gngrwzrd
5 Replies
LEARN ABOUT DEBIAN
g_order
g_order(1) GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c g_order(1)
NAME
g_order - computes the order parameter per atom for carbon tails
VERSION 4.5.4-dev-20110404-bc5695c
SYNOPSIS
g_order -f traj.xtc -n index.ndx -nr index.ndx -s topol.tpr -o order.xvg -od deuter.xvg -ob eiwit.pdb -os sliced.xvg -Sg sg-ang.xvg -Sk
sk-dist.xvg -Sgsl sg-ang-slice.xvg -Sksl sk-dist-slice.xvg -[no]h -[no]version -nice int -b time -e time -dt time -[no]w -xvg enum -d enum
-sl int -[no]szonly -[no]unsat -[no]permolecule -[no]radial -[no]calcdist
DESCRIPTION
Compute the order parameter per atom for carbon tails. For atom i the vector i-1, i+1 is used together with an axis. The index file should
contain only the groups to be used for calculations, with each group of equivalent carbons along the relevant acyl chain in its own group.
There should not be any generic groups (like System, Protein) in the index file to avoid confusing the program (this is not relevant to
tetrahedral order parameters however, which only work for water anyway).
The program can also give all diagonal elements of the order tensor and even calculate the deuterium order parameter Scd (default). If the
option -szonly is given, only one order tensor component (specified by the -d option) is given and the order parameter per slice is cal-
culated as well. If -szonly is not selected, all diagonal elements and the deuterium order parameter is given.
The tetrahedrality order parameters can be determined around an atom. Both angle an distance order parameters are calculated. See P.-L.
Chau and A.J. Hardwick, Mol. Phys., 93, (1998), 511-518. for more details.
FILES
-f traj.xtc Input
Trajectory: xtc trr trj gro g96 pdb cpt
-n index.ndx Input
Index file
-nr index.ndx Input
Index file
-s topol.tpr Input
Run input file: tpr tpb tpa
-o order.xvg Output
xvgr/xmgr file
-od deuter.xvg Output
xvgr/xmgr file
-ob eiwit.pdb Output
Protein data bank file
-os sliced.xvg Output
xvgr/xmgr file
-Sg sg-ang.xvg Output, Opt.
xvgr/xmgr file
-Sk sk-dist.xvg Output, Opt.
xvgr/xmgr file
-Sgsl sg-ang-slice.xvg Output, Opt.
xvgr/xmgr file
-Sksl sk-dist-slice.xvg Output, Opt.
xvgr/xmgr file
OTHER OPTIONS
-[no]hno
Print help info and quit
-[no]versionno
Print version info and quit
-nice int 19
Set the nicelevel
-b time 0
First frame (ps) to read from trajectory
-e time 0
Last frame (ps) to read from trajectory
-dt time 0
Only use frame when t MOD dt = first time (ps)
-[no]wno
View output .xvg, .xpm, .eps and .pdb files
-xvg enum xmgrace
xvg plot formatting: xmgrace, xmgr or none
-d enum z
Direction of the normal on the membrane: z, x or y
-sl int 1
Calculate order parameter as function of box length, dividing the box in nr slices.
-[no]szonlyno
Only give Sz element of order tensor. (axis can be specified with -d)
-[no]unsatno
Calculate order parameters for unsaturated carbons. Note that this cannot be mixed with normal order parameters.
-[no]permoleculeno
Compute per-molecule Scd order parameters
-[no]radialno
Compute a radial membrane normal
-[no]calcdistno
Compute distance from a reference (currently defined only for radial and permolecule)
SEE ALSO
gromacs(7)
More information about GROMACS is available at <http://www.gromacs.org/>.
Mon 4 Apr 2011 g_order(1)