예제 #1
0
/*
 * Test the pcsl_mem_allocate_chunk method
 * Sanity check test to see if pcsl_mem_allocate_chunk works OK
 */
void testAllocateChunk() {
    void * buffer = pcsl_mem_allocate_chunk(1000, 1100, 1);

    assertTrue("failed to allocate a 1000 byte buffer with pcsl_mem_allocate_chunk", 
	       (buffer != NULL));

    pcsl_mem_free_chunk(buffer);
}
예제 #2
0
/*
 * Test the pcsl_mem_allocate_chunk and pcsl_mem_adjust_chunk methods
 */
void testModifyChunkSize() {

    void * buffer = pcsl_mem_allocate_chunk(100, 200, 1);
    int rv;

    /* see if we can make the chunk larger than maxsize */
    rv = pcsl_mem_adjust_chunk(buffer, 300);
    assertTrue("pcsl_mem_adjust_chunk returned buffer size > max_size",
	       (rv == 0));

    /* OK...now try to increase the size to something reasonable */
    rv = pcsl_mem_adjust_chunk(buffer, 160);
    assertTrue("pcsl_mem_adjust_chunk returned incorrect previous buf size",
	       (rv == 100));

    /* OK...now decrease the size to 100, check to see old size was 160 */
    rv = pcsl_mem_adjust_chunk(buffer, 100);
    assertTrue("pcsl_mem_adjust_chunk returned incorrect previous buf size",
	       (rv == 160));

    pcsl_mem_free_chunk(buffer);
}
예제 #3
0
파일: OsMemory.cpp 프로젝트: sfsy1989/j2me
void OsMemory_free_chunk(address chunk_ptr) {
  pcsl_mem_free_chunk((void *)chunk_ptr);
}