コード例 #1
0
ファイル: shre.c プロジェクト: jtibbertsma/regex-engine
void cleanup_regex_engine() {
   assert(ptable);
   obhash_free(ptable);
   ptable = NULL;
   class_free(word_characters);
   word_characters = NULL;
}
コード例 #2
0
void *thread_func(void *arg) {
    int i;
    char *strings[10];

    for (i = 0; i<10; i++)
        strings[i] = (char *)class_malloc(1024); //allocate from classmem library
    for (i = 9; i>=0; i--)
        class_free(strings[i]);
    class_stats();
}
コード例 #3
0
ファイル: ma.c プロジェクト: jammen33/cpts224
int main(int argc, char * argv[]) {
	int i;
	char *strings[10];
	class_memory(mem,MSIZE); // give it memory allocator

	for (i = 0; i<10; i++)
		strings[i] = (char *)class_malloc(1024); //allocate from classmem library
	for (i = 9; i>=0; i--) 
		class_free(strings[i]);
	class_stats();
}
コード例 #4
0
ファイル: cma.c プロジェクト: Gyathair/cpts224_2012
void *class_realloc(void *ptr, size_t size) {
  void *mem;
  size_t oldsize;

  mem=class_malloc(size);
  if (!mem)
    return NULL;

  oldsize=PTRTOMNODE(ptr)->size;
  memcpy(mem,ptr,oldsize);

  class_free(ptr);
  return mem;
}
コード例 #5
0
ファイル: ma.c プロジェクト: cody-curry/CS224_HW8
int main(int argc, char * argv[]) {
	printf("%s Version %d.%d\n",argv[0],
		Cma_VERSION_MAJOR, Cma_VERSION_MINOR);
	printf("Usage: %s\n",argv[0]);

	int i;
	char *strings[10];
	class_memory(mem,MSIZE); // give it memory allocator

	for (i = 0; i<10; i++)
		strings[i] = (char *)class_malloc(1024); //allocate from classmem library
	for (i = 9; i>=0; i--) 
		class_free(strings[i]);
	class_stats();
}
コード例 #6
0
int main(int argc, char * argv[]) {
	int MSIZE;
	MSIZE = atoi(argv[1]);
	char * mem;
        mem = malloc(MSIZE);
	class_memory(mem,MSIZE); // give it memory allocator
	int n = 1;
	while (mem) {
		mem = class_malloc(n);
	        n *= 2;
	}	
	class_free(mem);
	class_stats();

	return 0;
}
コード例 #7
0
ファイル: dhanlen_test.c プロジェクト: glenn218k/cpts224_2012
int main(int argc, char * argv[])
{
	int i;
	double *arrays[ARRAYNUM];
	class_memory(mymemory,MSIZE); // give it memory allocator

	for (i = 0; i<ARRAYNUM; i++)
		arrays[i] = (double *)class_malloc(ARRAYSIZE); //allocate from classmem library
	for (i = 0; i<ARRAYNUM; i++)
		arrays[i][0] = i;
	for (i = 0; i<ARRAYNUM; i++)
		printf("%0.2d",arrays[i][0]);//print out the first element
	for (i = ARRAYNUM-1; i>=0; i--) 
		class_free(arrays[i]);
	class_stats();
	return 0;
}
コード例 #8
0
int main (int argc, char* argv[])
{	int i;
	char *alph[LIMIT];	// character array to allocate
	class_memory(m,SIZE2);	// pass char array of size SIZE2
									// to class_memory for allocation

	for (i = 0; i<LIMIT; i++)
		alph[i] = (int *)class_malloc(SIZE1);	// allocate using classmem lib
		
	for (i = 0; i<LIMIT; i++)
	{	alph[i] = i%26+'a';				// set member value
		printf("%c", (int) alph[i]);	// immediately print said value
	}
	puts("\n");	// end line
		
	for (i = LIMIT; i>0; i--) 
		class_free(alph[i]);	// release allocated memory used by alph array
	class_stats();	// pop stats up to see what's happened
}
コード例 #9
0
ファイル: dislagent.c プロジェクト: mur47x111/pDiSL
/**
 * Forces loading of the super class (or the implemented interfaces) of the
 * class being instrumented. For this, we need to parse the constant pool
 * of the class to discover the names of the classes to be force-loaded.
 * We then use JNI to find the classes, which will force their loading.
 */
static void
__force_classes (
	JNIEnv * jni, const char * class_name,
	const unsigned char * class_bytes, jint class_byte_count
) {
	assert (jni != NULL & jvm_is_started);

	class_t inst_class = class_alloc (class_bytes, class_byte_count);
	if (inst_class != NULL) {
		if (agent_config.force_superclass) {
			__force_superclass (jni, inst_class);
		}

		if (agent_config.force_interfaces) {
			__force_interfaces (jni, inst_class);
		}

		class_free (inst_class);

	} else {
		warn ("failed to parse class %s\n", __safe (class_name));
	}
}