*
*/
#include <switch.h>
+//#define DEBUG_ALLOC
struct switch_core_session {
unsigned long id;
switch_buffer *raw_write_buffer;
switch_frame raw_write_frame;
switch_frame enc_write_frame;
- unsigned char *raw_write_buf[SWITCH_RECCOMMENDED_BUFFER_SIZE];
- unsigned char *enc_write_buf[SWITCH_RECCOMMENDED_BUFFER_SIZE];
+ uint8_t raw_write_buf[SWITCH_RECCOMMENDED_BUFFER_SIZE];
+ uint8_t enc_write_buf[SWITCH_RECCOMMENDED_BUFFER_SIZE];
switch_buffer *raw_read_buffer;
switch_frame raw_read_frame;
switch_frame enc_read_frame;
- unsigned char *raw_read_buf[SWITCH_RECCOMMENDED_BUFFER_SIZE];
- unsigned char *enc_read_buf[SWITCH_RECCOMMENDED_BUFFER_SIZE];
+ uint8_t raw_read_buf[SWITCH_RECCOMMENDED_BUFFER_SIZE];
+ uint8_t enc_read_buf[SWITCH_RECCOMMENDED_BUFFER_SIZE];
switch_audio_resampler *read_resampler;
assert(session != NULL);
assert(session->pool != NULL);
+#ifdef DEBUG_ALLOC
+ switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Allocate %d\n", memory);
+#endif
+
+
if ((ptr = apr_palloc(session->pool, memory)) != 0) {
memset(ptr, 0, memory);
}
void *ptr = NULL;
assert(runtime.memory_pool != NULL);
+#ifdef DEBUG_ALLOC
+ switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Perm Allocate %d\n", memory);
+#endif
+
if ((ptr = apr_palloc(runtime.memory_pool, memory)) != 0) {
memset(ptr, 0, memory);
}
return NULL;
len = strlen(todup) + 1;
+
+#ifdef DEBUG_ALLOC
+ switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Perm Allocate %d\n", len);
+#endif
+
if (todup && (duped = apr_palloc(runtime.memory_pool, len)) != 0) {
strncpy(duped, todup, len);
}
}
len = strlen(todup) + 1;
+#ifdef DEBUG_ALLOC
+ switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Allocate %d\n", len);
+#endif
+
if (todup && (duped = apr_palloc(session->pool, len)) != 0) {
strncpy(duped, todup, len);
}
len = strlen(todup) + 1;
+#ifdef DEBUG_ALLOC
+ switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Allocate %d\n", len);
+#endif
+
if (todup && (duped = apr_palloc(pool, len)) != 0) {
strncpy(duped, todup, len);
}
{
void *ptr = NULL;
assert(pool != NULL);
+ assert(memory < 1000000);
+
+#ifdef DEBUG_ALLOC
+ switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Allocate %d\n", memory);
+#endif
if ((ptr = apr_palloc(pool, memory)) != 0) {
memset(ptr, 0, memory);
- switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Allocated memory pool.\n");
+ switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Allocated memory pool. Sessions are %d bytes\n", sizeof(struct switch_core_session));
switch_event_init(runtime.memory_pool);
assert(runtime.memory_pool != NULL);