You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2011/10/27 17:19:26 UTC

[lucy-commits] svn commit: r1189801 - in /incubator/lucy/branches/clownfish_lemon/clownfish: include/CFC.h lib/Clownfish.xs src/CFCMemPool.c typemap

Author: marvin
Date: Thu Oct 27 15:19:25 2011
New Revision: 1189801

URL: http://svn.apache.org/viewvc?rev=1189801&view=rev
Log:
Fix excess memory usage by MemPool and Parser.

MemPool's destructor was not being triggered because it lacked a Perl-space
DESTROY method.  Fix that, and also change the default arena size from 1 MiB
to 1 KiB.

Modified:
    incubator/lucy/branches/clownfish_lemon/clownfish/include/CFC.h
    incubator/lucy/branches/clownfish_lemon/clownfish/lib/Clownfish.xs
    incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCMemPool.c
    incubator/lucy/branches/clownfish_lemon/clownfish/typemap

Modified: incubator/lucy/branches/clownfish_lemon/clownfish/include/CFC.h
URL: http://svn.apache.org/viewvc/incubator/lucy/branches/clownfish_lemon/clownfish/include/CFC.h?rev=1189801&r1=1189800&r2=1189801&view=diff
==============================================================================
--- incubator/lucy/branches/clownfish_lemon/clownfish/include/CFC.h (original)
+++ incubator/lucy/branches/clownfish_lemon/clownfish/include/CFC.h Thu Oct 27 15:19:25 2011
@@ -23,6 +23,7 @@
 #include "CFCFunction.h"
 #include "CFCHierarchy.h"
 #include "CFCMethod.h"
+#include "CFCMemPool.h"
 #include "CFCParamList.h"
 #include "CFCParcel.h"
 #include "CFCParser.h"

Modified: incubator/lucy/branches/clownfish_lemon/clownfish/lib/Clownfish.xs
URL: http://svn.apache.org/viewvc/incubator/lucy/branches/clownfish_lemon/clownfish/lib/Clownfish.xs?rev=1189801&r1=1189800&r2=1189801&view=diff
==============================================================================
--- incubator/lucy/branches/clownfish_lemon/clownfish/lib/Clownfish.xs (original)
+++ incubator/lucy/branches/clownfish_lemon/clownfish/lib/Clownfish.xs Thu Oct 27 15:19:25 2011
@@ -2112,3 +2112,11 @@ CODE:
 OUTPUT: RETVAL
 
 
+MODULE = Clownfish    PACKAGE = Clownfish::MemPool
+
+void
+DESTROY(self)
+    CFCMemPool *self;
+PPCODE:
+    CFCMemPool_destroy(self);
+

Modified: incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCMemPool.c
URL: http://svn.apache.org/viewvc/incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCMemPool.c?rev=1189801&r1=1189800&r2=1189801&view=diff
==============================================================================
--- incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCMemPool.c (original)
+++ incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCMemPool.c Thu Oct 27 15:19:25 2011
@@ -39,11 +39,11 @@ CFCMemPool_new(size_t arena_size) {
 
 CFCMemPool*
 CFCMemPool_init(CFCMemPool *self, size_t arena_size) {
-    arena_size = arena_size ? arena_size : 0x100000;
+    arena_size = arena_size ? arena_size : 0x400; // 1k
     self->current    = NULL;
     self->arena_size = arena_size;
     self->remaining  = 0;
-    self->num_arenas = 1;
+    self->num_arenas = 0;
     self->arenas     = NULL;
     return self;
 }

Modified: incubator/lucy/branches/clownfish_lemon/clownfish/typemap
URL: http://svn.apache.org/viewvc/incubator/lucy/branches/clownfish_lemon/clownfish/typemap?rev=1189801&r1=1189800&r2=1189801&view=diff
==============================================================================
--- incubator/lucy/branches/clownfish_lemon/clownfish/typemap (original)
+++ incubator/lucy/branches/clownfish_lemon/clownfish/typemap Thu Oct 27 15:19:25 2011
@@ -23,6 +23,7 @@ CFCFile*	CLOWNFISH_TYPE
 CFCFunction*	CLOWNFISH_TYPE
 CFCHierarchy*	CLOWNFISH_TYPE
 CFCMethod*	CLOWNFISH_TYPE
+CFCMemPool*	CLOWNFISH_TYPE
 CFCParamList*	CLOWNFISH_TYPE
 CFCParcel*	CLOWNFISH_TYPE
 CFCParser*	CLOWNFISH_TYPE