Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "KOL";
Текущий архив: 2005.09.04;
Скачать: [xml.tar.bz2];

Вниз

objects allocation on the stack (speedy) is it possible in KOL?   Найти похожие ветки 

 
thaddy   (2005-01-24 19:35) [0]

something by Robert Marsh:
Is it possible to implement in kol?
I am still unsuccesfull in translating it

http://www.undu.com/Articles/010327a.html


 
Владимир Кладов   (2005-01-24 21:11) [1]

Don"t know about object allocation, but it is possible to allocate an array:

function UseStack( Size: DWORD ): Pointer;
asm
 POP ECX
 SUB ESP, EAX
 MOV EAX, ESP
 PUSH ECX
end;

procedure UnUseStack( Size: DWORD );
asm
 POP ECX
 ADD ESP, EAX
 PUSH ECX
end;

{$STACKFRAMES ON} // *** REQUIRED!
procedure TForm1.Button6Click(Sender: PObj);
const sz = 10000;
var Ptr: Pointer;
begin
 Ptr := UseStack( sz );

 FillChar( Ptr^, sz, $AB );

 UnUseStack( sz );
end;


No memory manager replacement required, usage very simple, but... dangerous!


 
thaddy   (2005-01-24 23:19) [2]

Yes! I knew that trick :) but my problem with the (equally dangerous) translation of the code was that I could find no wat to determine if a call was from the inside if a Kol object or not.
Is there a way to determine where the memory allocation for a Tobj starts (yes, found it) and ends (no, could not determine that)?

What I want to achieve is a speedy way to allocate and de-allocate small objects by simply replacing the memory manager, as Robert Marsh has done in his sourcecode.

Btw: the code in grids.pas is safer than yours, because it always 'touches' the page boundary, thus allocating/growing the stack if appropiate. This only fails if you allocate more than 1 Mb of space since that is the standard amount of stackspace given to any given process or thread.

There has to be Some way??



Страницы: 1 вся ветка

Форум: "KOL";
Текущий архив: 2005.09.04;
Скачать: [xml.tar.bz2];

Наверх




Память: 0.44 MB
Время: 0.009 c
3-1120637722
-=snoop=-
2005-07-06 12:15
2005.09.04
Работа с dbf в Delphi через ADO


14-1123802724
Kerk
2005-08-12 03:25
2005.09.04
American Beauty


4-1121589578
Arc
2005-07-17 12:39
2005.09.04
Локальный хук на WM_SETTEXT


2-1121775602
drakoga
2005-07-19 16:20
2005.09.04
Как оприделить температуру


5-1095963566
Igor_
2004-09-23 22:19
2005.09.04
Обработчик событий OnKeyPress





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский