From: <syn...@gm...> - 2005-02-27 17:03:17
|
Richard Sposato wrote: >> I've read your proposal and here are some points: >> - I don't understand why you get trouble with the compiler when >> implementing >> new [] and delete []. If you implement it by your own you can manage >> everything by your own. >> Or is the problem that when deallocating a array the information which >> version of new[] was used is lost? > > > It is actually both problems. I can't quite manage everything on my own > with the current array allocation implementation. And some information > is lost between the array allocation and the array deallocation. I try > to store off some info just before the array overhead, but that does not > always work. > > When I test array allocation, all allocation and deallocation requests > were passed through the small-object allocator, even those that were too > large for it. Some parts of my implementation deal with determining if > a deallocation request should be handled by the small-object allocator, > or by the default allocator. > What are the possible solutions? 1. store in the array the information which new[] was used 2. remember how each object was created somewere else 1. don't use the default allocator, implement new[] also for large objects Comments: 1. - you've tried this, but it only works with msvc. - use different implementations for different compilers, but it's hard to maintain such code. 2. - it's memory intensive - it needs additional time to search the vector/list of remembered pointers + maybe the cases of calling global new[] is very seldom 3. - work must be done on a subject which is already solved by the global new. Peter |