inc/localmem.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define lmAllocVar(lm, pt)   (pt = lmAlloc(lm, sizeof(*pt)));
#define lmAllocArray(lm, pt, size)   (pt = lmAlloc(lm, sizeof(*pt) * (size)))

Functions

lmlmInit (int blockSize)
void lmCleanup (struct lm **pLm)
void * lmAlloc (struct lm *lm, size_t size)
char * lmCloneString (struct lm *lm, char *string)
slNamelmSlName (struct lm *lm, char *name)
void * lmCloneMem (struct lm *lm, void *pt, size_t size)


Define Documentation

#define lmAllocArray ( lm,
pt,
size   )     (pt = lmAlloc(lm, sizeof(*pt) * (size)))

Definition at line 35 of file localmem.h.

Referenced by bandExt(), and ffFindExtendNmers().

#define lmAllocVar ( lm,
pt   )     (pt = lmAlloc(lm, sizeof(*pt)));

Definition at line 31 of file localmem.h.

Referenced by boxFindClumps(), chainBlocks(), ffAliFromSym(), ffFindExtendNmers(), getHitsFromServer(), gfFastFindDnaHits(), gfSegmentedFindHits(), gfSegmentedFindNearHits(), gfStraightFindHits(), gfStraightFindNearHits(), kdBuild(), kdTreeMake(), pslQueryGet(), rBoxJoin(), rbTreeAdd(), ssFindBestBig(), and twoBitOpen().


Function Documentation

void* lmAlloc ( struct lm lm,
size_t  size 
)

Definition at line 78 of file localmem.c.

References lm::allignAdd, lm::allignMask, lm::blocks, lmBlock::end, lmBlock::free, lm, and newBlock().

Referenced by ffNeedMem(), gffNeedMem(), hashAddN(), lmCloneMem(), lmCloneString(), lmSlName(), localNeedMem(), newFofRecEl(), newHash(), pslLoadLm(), pslxLoadLm(), and rbTreeNew().

00080 {
00081 struct lmBlock *mb = lm->blocks;
00082 void *ret;
00083 size_t memLeft = mb->end - mb->free;
00084 if (memLeft < size)
00085     mb = newBlock(lm, size);
00086 ret = mb->free;
00087 mb->free += ((size+lm->allignAdd)&lm->allignMask);
00088 if (mb->free > mb->end)
00089     mb->free = mb->end;
00090 return ret;
00091 }

Here is the call graph for this function:

Here is the caller graph for this function:

void lmCleanup ( struct lm **  pLm  ) 

Definition at line 67 of file localmem.c.

References lm::blocks, freeMem(), lm, and slFreeList().

Referenced by bandExt(), chainBlocks(), cleanupMem(), dnaQuery(), ffMemCleanup(), fofMake(), freeHash(), genoFindDirect(), gfAlignTrans(), gfAlignTransTrans(), gffClose(), gfFindAlignAaTrans(), gfTransTransFindBundles(), rbTreeFree(), searchOneProt(), ssFindBestBig(), transQuery(), and transTransQuery().

00069 {
00070     struct lm *lm = *pLm;
00071     if (lm == NULL)
00072         return;
00073     slFreeList(&lm->blocks);
00074     freeMem(lm);
00075     *pLm = NULL;
00076 }

Here is the call graph for this function:

Here is the caller graph for this function:

void* lmCloneMem ( struct lm lm,
void *  pt,
size_t  size 
)

Definition at line 93 of file localmem.c.

References lm, and lmAlloc().

Referenced by rangeTreeAdd().

00095 {
00096 void *d = lmAlloc(lm, size);
00097 memcpy(d, pt, size);
00098 return d;
00099 }

Here is the call graph for this function:

Here is the caller graph for this function:

char* lmCloneString ( struct lm lm,
char *  string 
)

Definition at line 101 of file localmem.c.

References lm, and lmAlloc().

Referenced by hashTwoColumnFile(), pslLoadLm(), pslxLoadLm(), raFoldInOneRetName(), raFromString(), and raNextRecord().

00103 {
00104 if (string == NULL)
00105     return NULL;
00106 else
00107     {
00108     int size = strlen(string)+1;
00109     char *s = lmAlloc(lm, size);
00110     memcpy(s, string, size);
00111     return s;
00112     }
00113 }

Here is the call graph for this function:

Here is the caller graph for this function:

struct lm* lmInit ( int  blockSize  )  [read]

Definition at line 47 of file localmem.c.

References lm, needMem(), and newBlock().

Referenced by bandExt(), boxFindClumps(), chainBlocks(), dnaQuery(), ffFindExtendNmers(), ffMemInit(), fofMake(), genoFindDirect(), gfAlignTrans(), gfAlignTransTrans(), gfFindAlignAaTrans(), gffOpen(), gfLongDnaInMem(), gfTransTransFindBundles(), initMem(), newHash(), rbTreeNew(), searchOneProt(), ssFindBestBig(), transQuery(), and transTransQuery().

00049 {
00050 struct lm *lm;
00051 int aliSize = sizeof(long);
00052 if (aliSize < sizeof(double))
00053     aliSize = sizeof(double);
00054 if (aliSize < sizeof(void *))
00055     aliSize = sizeof(void *);
00056 lm = needMem(sizeof(*lm));
00057 lm->blocks = NULL;
00058 if (blockSize <= 0)
00059     blockSize = (1<<14);    /* 16k default. */
00060 lm->blockSize = blockSize;
00061 lm->allignAdd = (aliSize-1);
00062 lm->allignMask = ~lm->allignAdd;
00063 newBlock(lm, blockSize);
00064 return lm;
00065 }

Here is the call graph for this function:

Here is the caller graph for this function:

struct slName* lmSlName ( struct lm lm,
char *  name 
) [read]

Definition at line 115 of file localmem.c.

References lm, lmAlloc(), and slName::name.

00117 {
00118 struct slName *n;
00119 int size = sizeof(*n) + strlen(name) + 1;
00120 n = lmAlloc(lm, size);
00121 strcpy(n->name, name);
00122 return n;
00123 }

Here is the call graph for this function:


Generated on Tue Dec 25 19:04:09 2007 for blat by  doxygen 1.5.2