This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RE: CYGNUM_INFRA_EMPTY_DELETE_THRESHOLD value


Steven Clugston wrote:
-----Original Message-----
From: ecos-discuss-owner@ecos.sourceware.org
[mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Siva Kumar
Sent: 23 August 2006 15:50
To: eCos Discussion
Subject: [ECOS] CYGNUM_INFRA_EMPTY_DELETE_THRESHOLD value


I took the latest CVS code base and built ecos. But with
assertions enabled, I'm running into assertion on cxxsupp.cxx test case wherein the condition :


CYG_ASSERT(counter < CYGNUM_INFRA_EMPTY_DELETE_THRESHOLD, "Do
you want an empty delete function?");

is failing in the first delete call itself (counter value is
1). In the ecos library [include/pkgconf/infra.h], I saw that the value of CYGNUM_INFRA_EMPTY_DELETE_THRESHOLD is just '1' and not 100 as the descriptions say. Hence the assertion!


In the infra.cdl, when I changed the flavor of the above macro
to data, the ecc file was generated as needed with the value of the macro as default (100). With this ecc, when I built the target file, assertion never happened. Why is CYGNUM_INFRA_EMPTY_DELETE_THRESHOLD,
a boolean instead of data, if it has to take a value of 100 by default? Pls shed some light.


Regards
Siv

I've had this assert also.


I get in the generated: <include/pkgconf/infra.h>

#define CYGNUM_INFRA_EMPTY_DELETE_THRESHOLD 1

And in the generated eec:

cdl_option CYGNUM_INFRA_EMPTY_DELETE_THRESHOLD {
    # ActiveIf constraint: CYGPKG_INFRA_DEBUG
    #     CYGPKG_INFRA_DEBUG == 1
    #   --> 1

    # Flavor: bool
    # No user value, uncomment the following line to provide one.
    # user_value 1
    # value_source default
    # Default value: 1
};

infra.cdl:

cdl_option CYGNUM_INFRA_EMPTY_DELETE_THRESHOLD {
        display       "Threshold for valid number of delete calls"
        default_value 100
        active_if     CYGPKG_INFRA_DEBUG
        description   "
            Some users don't know about the empty delete function and
then
            wonder why their C++ classes are leaking memory. If
            INFRA_DEBUG is enabled we keep a counter for the number of
            times delete is called. If it goes above this threshold we
throw
            an assertion failure. This should point heavy users of
            delete in the right direction without upsetting those who
want
            an empty delete function. "
}


Just to clarify, did you change the above to:


cdl_option CYGNUM_INFRA_EMPTY_DELETE_THRESHOLD {
        display       "Threshold for valid number of delete calls"
        flavor  data
        default_value 100
        active_if     CYGPKG_INFRA_DEBUG
        description   "
            Some users don't know about the empty delete function and
then
            wonder why their C++ classes are leaking memory. If
            INFRA_DEBUG is enabled we keep a counter for the number of
            times delete is called. If it goes above this threshold we
throw
            an assertion failure. This should point heavy users of
            delete in the right direction without upsetting those who
want
            an empty delete function. "
}

Looks like the default flavor is bool and the flavor data was omitted
from infra.cdl. Can this be patched so future cvs snapshots are
corrected?

I've committed this change.


Next time, please send your changes as a proper patch (attachments
are best to avoid email mangling), along with a ChangeLog entry to
ecos-patches@ecos.sourceware.org

Thanks

--
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------
Index: infra/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/infra/current/ChangeLog,v
retrieving revision 1.55
diff -u -5 -p -r1.55 ChangeLog
--- infra/current/ChangeLog	19 May 2006 10:14:07 -0000	1.55
+++ infra/current/ChangeLog	25 Aug 2006 12:05:49 -0000
@@ -1,5 +1,10 @@
+2006-08-25  Gary Thomas  <gary@mlbassoc.com>
+
+	* cdl/infra.cdl: 
+	CYGNUM_INFRA_EMPTY_DELETE_THRESHOLD must be 'data', not 'boolean'
+
 2006-05-17  David Vrabel <dvrabel@arcom.com>
  
 	* include/cyg_type.h: #define CYG_NELEM to calculate the
  	number of elements in a (statically allocated) array.
  
Index: infra/current/cdl/infra.cdl
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/infra/current/cdl/infra.cdl,v
retrieving revision 1.14
diff -u -5 -p -r1.14 infra.cdl
--- infra/current/cdl/infra.cdl	23 Oct 2005 20:33:10 -0000	1.14
+++ infra/current/cdl/infra.cdl	25 Aug 2006 12:05:51 -0000
@@ -177,10 +177,11 @@ cdl_package CYGPKG_INFRA {
             so that new and delete can be used, if that is what is required."
     }
 
     cdl_option CYGNUM_INFRA_EMPTY_DELETE_THRESHOLD {
         display       "Threshold for valid number of delete calls"
+        flavor        data
         default_value 100
         active_if     CYGPKG_INFRA_DEBUG
         description   "
             Some users don't know about the empty delete function and then
             wonder why their C++ classes are leaking memory. If

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]