*****************************************************************************/
/*
- * Copyright (C) 2000 - 2004, R. Byron Moore
+ * Copyright (C) 2000 - 2005, R. Byron Moore
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
ACPI_FUNCTION_ENTRY ();
+ cache_info = &acpi_gbl_memory_lists[list_id];
+
+#ifdef ACPI_ENABLE_OBJECT_CACHE
+
/* If walk cache is full, just free this wallkstate object */
- cache_info = &acpi_gbl_memory_lists[list_id];
if (cache_info->cache_depth >= cache_info->max_cache_depth) {
ACPI_MEM_FREE (object);
ACPI_MEM_TRACKING (cache_info->total_freed++);
(void) acpi_ut_release_mutex (ACPI_MTX_CACHES);
}
+
+#else
+
+ /* Object cache is disabled; just free the object */
+
+ ACPI_MEM_FREE (object);
+ ACPI_MEM_TRACKING (cache_info->total_freed++);
+#endif
}
cache_info = &acpi_gbl_memory_lists[list_id];
+
+#ifdef ACPI_ENABLE_OBJECT_CACHE
+
if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_CACHES))) {
return (NULL);
}
ACPI_MEM_TRACKING (cache_info->total_allocated++);
}
+#else
+
+ /* Object cache is disabled; just allocate the object */
+
+ object = ACPI_MEM_CALLOCATE (cache_info->object_size);
+ ACPI_MEM_TRACKING (cache_info->total_allocated++);
+#endif
+
return (object);
}
+#ifdef ACPI_ENABLE_OBJECT_CACHE
/******************************************************************************
*
* FUNCTION: acpi_ut_delete_generic_cache
cache_info->cache_depth--;
}
}
+#endif
/*******************************************************************************
* RETURN: Status
*
* DESCRIPTION: Validate that the buffer is of the required length or
- * allocate a new buffer.
+ * allocate a new buffer. Returned buffer is always zeroed.
*
******************************************************************************/
/* Allocate a new buffer with local interface to allow tracking */
- buffer->pointer = ACPI_MEM_ALLOCATE (required_length);
+ buffer->pointer = ACPI_MEM_CALLOCATE (required_length);
if (!buffer->pointer) {
return (AE_NO_MEMORY);
}
-
- /* Clear the buffer */
-
- ACPI_MEMSET (buffer->pointer, 0, required_length);
break;
default:
- /* Validate the size of the buffer */
+ /* Existing buffer: Validate the size of the buffer */
if (buffer->length < required_length) {
status = AE_BUFFER_OVERFLOW;
+ break;
}
+
+ /* Clear the buffer */
+
+ ACPI_MEMSET (buffer->pointer, 0, required_length);
break;
}
acpi_status status;
- allocation = acpi_ut_allocate (size + sizeof (struct acpi_debug_mem_block), component,
+ allocation = acpi_ut_allocate (size + sizeof (struct acpi_debug_mem_header), component,
module, line);
if (!allocation) {
return (NULL);
acpi_status status;
- allocation = acpi_ut_callocate (size + sizeof (struct acpi_debug_mem_block), component,
+ allocation = acpi_ut_callocate (size + sizeof (struct acpi_debug_mem_header), component,
module, line);
if (!allocation) {
/* Report allocation error */
allocation->line = line;
ACPI_STRNCPY (allocation->module, module, ACPI_MAX_MODULE_NAME);
+ allocation->module[ACPI_MAX_MODULE_NAME-1] = 0;
/* Insert at list head */
* DESCRIPTION: Print some info about the outstanding allocations.
*
******************************************************************************/
-
+#ifdef ACPI_FUTURE_USAGE
void
acpi_ut_dump_allocation_info (
void)
*/
return_VOID;
}
+#endif /* ACPI_FUTURE_USAGE */
/*******************************************************************************