1832420 Members
3229 Online
110042 Solutions
New Discussion

Method free of aCC ...

 
bibi_1
Occasional Contributor

Method free of aCC ...

Sometimes, My application crashes when method free of file /opt/aCC/include/memory is called ...
i a not sure that the problem comes from my application ...
Do you know if aCC should be compiled with specific flags when application is a multi-thread application ... (because i saw in file memory where source of operation free and delete are defined , that flags for multi-thread exist ...
yop
1 REPLY 1
Adam J Markiewicz
Trusted Contributor

Re: Method free of aCC ...

Hi

I have a bad news for you.
Crashes during free() 99,9% comes from bug in a program, but most frequently from very differenty place. In other words you write under address you shouldnt use, and therefore corrupt the memory. When you call free() this corruption jumps out of the box. The other reason may be calling free() with bad address - freeing memory twice for example, but these are relatively easy to catch.

The other info I can give you is that:
operators new and delete are implemented as calls to malloc() and free() (however _do_not_ use free() for memory allocated with new, of course).
malloc() and free() are implemented to be multithread safe (the use internal mutex to protect data consistency, if you're interested), so there is no need to check these flags at compile time for them.

Good luck
Adam
I do everything perfectly, except from my mistakes