|
there are several ways, one of which is to control your own allocation. You allocate a large block, then divvy it up into smaller pieces that are passed as allocated blocks to nodes, then you can deallocate by the large block if necessary and then everything is gone. Photoshop, in pre 5.0 versions often did not release memory, once allocated it gets thrown on a reuse heap internally. Another way is simply to store pointers to all allocated blocks in a list, then it is a linear release, no traversals for a delete all.
There are papers on internal garbage collection routines and efficient process operations related to almost any subject, including memory allocation.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
Indeed. If you're working with C++ classes, then you can provide class specific new and delete operators (for single objects and arrays). This means that in a Win32 environment you can hit the VMM directly (VirtualAlloc/VirtualFree) if it's appropriate, to do whatever you want.
Just carried out such an exercise on a server app (along with reshaping the internal data representation) and it was worth it - as reported by profiling the app with 'typical' and 'degenerate' loading.
Steve S
Developer for hire
|
|
|
|
|
Not sure this[^] is legal, but it led me to this[^] which seems interesting. The former link is also mentioned in the latter. So it might be.
"I know which side I want to win regardless of how many wrongs they have to commit to achieve it." - Stan Shannon
Web - Blog - RSS - Math - LinkedIn
|
|
|
|
|
Good find.
It always takes me an age to translate something from the book into CS, this is a real time saver!
|
|
|
|
|
The former link is also mentioned in the latter. So it might be.
LOL.. Got me to 'CLICK'
|
|
|
|
|
Hi!
I'm just looking for your thoughts and ideas on what would be the most elegant way to implement a system of Si units in C++.
Cheers,
--
Mike
|
|
|
|
|
Units are only semantic definitions over the variables used in your applications.
In your design, you should mention that all values are in SI units, and offer appropriate conversions functions between base units ( meter, kilogram, ... ) and alternative unit type (inches, pound, onces, ... )
after that, it's only a matter of enforcing, really not hard, those rules.
or maybe I did not understand what you want.
|
|
|
|
|
Maximilien wrote: Units are only semantic definitions over the variables used in your applications.
This need not be the case. An interesting discussion can be found here[^] in the Boost documentation. Code can be found in the Boost vault here[^].
Steve
|
|
|
|
|
An interesting discussion can be found here[^] in the Boost documentation. Code can be found in the Boost vault here[^].
Steve
|
|
|
|
|
it still is semantics.
in their example of multiplication
F = m . a
quantity<float,force> f = m * a;
you have to distinct "dimensions" one mass (FG) and one acceleration( m/s ) and the result which is a force ( newton )
they all have disctinct semantics, and the result is still valid.
for such a system to work in the context of symbolic equations ( F=MA )one would need to validate all combinations of operands dimensions that can result in another third dimensions.
quantity<float,mass> bogus = m * a; , they say it is not valid, but it's only mathematic/physic semantic
in that example, you will have to know and code that a Force is only Mass x Acceleration.
I think they are confusion symbolic expressions with numerical computation.
I don't believe I express myself correctly on that matter.
anyway, this is one great discussion!!!
|
|
|
|
|
The point of the Boost stuff is that you declare a type called "force", for example. You also have a type called "mass" and "acceleration". Now if you try to write f=mv ("f" is if type "force", "m" is of type "mass" and "v" is of type "velocity") you get a compiler error. If you just use normal numeric types no such checks are possible.
Steve
|
|
|
|
|
You are required to write a program which generates pie-chart using the given data during the development of an application. What will be the algorithm of your program
Asif
|
|
|
|
|
ch.Asif wrote: What will be the algorithm of your program
Ah, but of course it will be one that can generate pie-charts using the given data!
every night, i kneel at the foot of my bed and thank the Great Overseeing Politicians for protecting my freedoms by reducing their number, as if they were deer in a state park. -- C hris L osinger, Online Poker Players?
|
|
|
|
|
ch.Asif wrote: You are required to write a program which generates pie-chart using the given data during the development of an application. What will be the algorithm of your program
data.read()
data.process()
data.draw_piechart()
in steps 2&3, always remember: Any sufficiently advanced technology is indistinguishable from magic. – Arthur C. Clarke, 1962
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
data.read()
data.process()
If(Cherry)
data.draw_piechart(Cherry)
elseif (blueberry)
data.draw_piechart(bluebarry)
elseif(fruit)
.........
SORRY I just had to!
|
|
|
|
|
This sounds like a test question.
|
|
|
|
|
I'd use
3D Pie Chart By Julijan Sribar. Found on the Code Project!
|
|
|
|
|
Geee. I have to ask such a simple question but I AM SURE you folks are ALOT smarter than me! Especially at math! (But I work with with my hands like a Master!) Anyway, seemed so simple untill I tried to do it.. LOL..
Lets say you have a Joystick that inputs 0 to 1000 units. I want to limit the output to some variable (To keep it simple I'll use whole numbers) to some variable such as 40, 50, 60 etc. that gives a output that is from 0 to this variable in equal units?
I'm so STUPID at Math! Sorry my Left or Right brain not working for this simple problem!
|
|
|
|
|
divide the actual output by 1000, then multiply by your variable to get the new scaled output.
onew = (oold /1000) * var
|
|
|
|
|
SO SORRY I voted a 1 when I should have Voted a 5! I told you I was STUPID!
At first glance my brain said 1 was THE BEST..
Thank You.. DO not be to harsh on me.. I'm really a nice old man..
|
|
|
|
|
And if your joystick is connected to an embedded system with no hardware floating point support, you can keep everything in integer with good results by reordering the arithmetic:
onew = (oold * var) / 1000
You might have to cast the old variable to the next larger type to be sure you don't overflow and then cast back.
The evolution of the human genome is too important to be left to chance.
|
|
|
|
|
i think solution is in following steps
1.get the maximum value of the out put.say you get that for input 1000.
it means you would want to get myMaxLimit when you get maxOP
2.so now you can use follwoing formula to limit your input
desiredOP = (currentOP/maxOP)*myMaxLimit
sameer
|
|
|
|
|
I would like to add, to the other comments psted here, that you can also do integer rounding. For example:
(1456+500)/1000=1
(1677+500)/1000=2
As you can see 1456 gets rounded to 1 and 1677 gets rounded to 2. It is just like rounding floating point numbers 1.456 and 1.677. In fact, all values from 500 to 1499 will be rounded to 1, and all values from 1500 to 2499 will be rounded to 2.
Rogério Rilhas
|
|
|
|
|
Hi i'm a maths b student and i need some help with a question on a maths assignment, The question is:
The question asks me to find an equation fo each of the 5 parabolas of a bridge given that:
1. the width of the bridge is 40m
2. The maximum height of the road section at the top is 2m
3. The height of the tallest supporting parabola is 13m
4. The height of the smaller supporting parabolas is 8m.
I know the equation I need to use and it is
y = ax^2 + bx^2 + c
Then the equation goes to
y = a(x-p)^2 + q
Can you please help me out because I don't know how i should start it.
PLEASE HELP, ASAP
Any help would be much appreciated.
|
|
|
|
|
Try expressing height of a given parabola H as a function of its width at the base W (H(W))
|
|
|
|