You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sa...@apache.org on 2006/03/25 19:03:22 UTC
svn commit: r388791 - in /webservices/axis2/trunk/c: include/axis2_env.h
modules/core/transport/http/receiver/http_svr_thread.c
modules/util/dir_handler.c modules/util/env.c
Author: sahan
Date: Sat Mar 25 10:03:22 2006
New Revision: 388791
URL: http://svn.apache.org/viewcvs?rev=388791&view=rev
Log:
Getting closer to 0 mem leaks in Linux
Modified:
webservices/axis2/trunk/c/include/axis2_env.h
webservices/axis2/trunk/c/modules/core/transport/http/receiver/http_svr_thread.c
webservices/axis2/trunk/c/modules/util/dir_handler.c
webservices/axis2/trunk/c/modules/util/env.c
Modified: webservices/axis2/trunk/c/include/axis2_env.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_env.h?rev=388791&r1=388790&r2=388791&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_env.h (original)
+++ webservices/axis2/trunk/c/include/axis2_env.h Sat Mar 25 10:03:22 2006
@@ -126,7 +126,19 @@
* @return pointer to the newly created environment struct
*/
AXIS2_DECLARE(axis2_status_t) axis2_env_free (axis2_env_t *env);
-
+
+ /**
+ * Frees the environment
+ * @param env environment to be freed
+ * @param mask bit pattern to according to which the components of the env struct are freed
+ * 0x1 - Frees the log
+ * 0x2 - Frees the error
+ * 0x4 - Frees the thread pool
+ * You can use combinations to free multiple components as well
+ * Eg : 0x3 frees both log and error
+ * @return status of the operation
+ */
+ AXIS2_DECLARE(axis2_status_t) axis2_env_free_masked(axis2_env_t *env, char mask);
/**
* Enables logging
*/
Modified: webservices/axis2/trunk/c/modules/core/transport/http/receiver/http_svr_thread.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/receiver/http_svr_thread.c?rev=388791&r1=388790&r2=388791&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/receiver/http_svr_thread.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/receiver/http_svr_thread.c Sat Mar 25 10:03:22 2006
@@ -348,6 +348,7 @@
secs);
#endif
}
+ axis2_env_free_masked(thread_env, 0x2);
#ifdef AXIS2_SVR_MULTI_THREADED
AXIS2_THREAD_POOL_EXIT_THREAD((*env)->thread_pool, thd);
#endif
Modified: webservices/axis2/trunk/c/modules/util/dir_handler.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/dir_handler.c?rev=388791&r1=388790&r2=388791&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/dir_handler.c (original)
+++ webservices/axis2/trunk/c/modules/util/dir_handler.c Sat Mar 25 10:03:22 2006
@@ -326,10 +326,11 @@
fname = NULL;
}
#ifndef WIN32
-
- /*AXIS2_FREE((*env)->allocator, *files);*/
- /*AXIS2_FREE((*env)->allocator, files);*/
-
+ for(i = 0; i < count; i++)
+ {
+ AXIS2_FREE((*env)->allocator, files[i]);
+ }
+ AXIS2_FREE((*env)->allocator, files);
#endif
return file_list;
}
Modified: webservices/axis2/trunk/c/modules/util/env.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/env.c?rev=388791&r1=388790&r2=388791&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/env.c (original)
+++ webservices/axis2/trunk/c/modules/util/env.c Sat Mar 25 10:03:22 2006
@@ -162,3 +162,21 @@
}
return AXIS2_SUCCESS;
}
+
+AXIS2_DECLARE(axis2_status_t) axis2_env_free_masked(axis2_env_t *env, char mask)
+{
+ if(mask & 0x1)
+ {
+ AXIS2_LOG_FREE(env->allocator, env->log);
+ }
+ if(mask & 0x2)
+ {
+ AXIS2_ERROR_FREE(env->error);
+ }
+ if(mask & 0x4)
+ {
+ AXIS2_THREAD_POOL_FREE(env->thread_pool);
+ }
+ if(NULL != env)
+ free (env);
+}