This is the mail archive of the ecos-discuss@sources.redhat.com 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]

Question about empty C++delete functions


Dear all,

I have a question about the "Provide empty C++ delete functions" (CYGFUN_INFRA_EMPTY_DELETE_FUNCTIONS) option of eCos configuration.

If I keep it to its default value (enabled state), the memory allocated after a class object new is never freed when the class object is deleted.

So, newing and deleting several objects will fill the target memory and finally bring to a target crash.

As I haven't really understood the explanation given in the Configuration Tool, could someone tell me more about this option utility ?


Here is the test code :

class classe_test
{
public:
classe_test();
~classe_test();
int value ;
};

classe_test::classe_test()
{
value = 0 ;
}

classe_test::~classe_test()
{
}

int main()
{
int i ;

for (i=0;i<10;i++)
{
classe_test *c = new classe_test ;
printf("c = 0x%x\n\r",c);
delete c;
}
}

The output is :
c = 0xc52808
c = 0xc52818
c = 0xc52828
c = 0xc52838
c = 0xc52848
c = 0xc52858
c = 0xc52868
c = 0xc52878
c = 0xc52888
c = 0xc52898


You can see the not-freed memory corresponding to each object (4 bytes).

Thanks in advance for your help,


Joris



****************************************************************************
Ce message et ses pieces jointes contiennent des informations
confidentielles.
Il est etabli a l'intention exclusive de ses destinataires.
Si vous n'en etes pas destinataire, merci de le detruire et d'en avertir
immediatement l'expediteur.
L'integrite de ce message ne pouvant etre garantie sur Internet, Inventel
Systemes ne peut etre tenue responsable de son contenu.

This e-mail and its attachments are confidential and intended solely for the
addressees.
If you are not the intended recipient of this message, then please delete it
and notify the sender.
Since the integrity of this message cannot be guaranteed on the
Internet,Inventel Systemes cannot therefore be considered responsible for
its content.
****************************************************************************


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


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