Re: How to allocate memory for a linked list of pointers in a kernel process



joemango <joseandremorales@xxxxxxxxx> wrote:

Hi everyone, i am building a short program that builds several linked
lists using pointers of course. Its my first time doing this in the
kernel, i need to know the best way to allocate memory when i create a
new pointer that will for multiple pointers to be created without
causing a system crash, I had started with pointer delclaration
getting memory allocation with the ExAllocatePoolXxx function. but
quickly found that would not work i was declaring too many pointers
and used up all of the small amount of pool memory causing a BSOD !

For gosh sakes, how many pointers are you allocating? If you run with
Driver Verifier, ExAllocatePool ends up allocating a page per allocation,
which could eat up space, but otherwise I'm confused.

so now i need to know what i can use to access memory for my linked
lists that wont cause teh BSOD and the right way to do to be efficient
with memory usage.

Linked lists of what? Usually, the linked list pointers will be part of
another, larger structure. When the kernel routines need to allocate a
bunch of items of the same size, they use a lookaside list
(ExInitializePagedLookasideList, ExAllocateFromPagedLookasideList, etc).

Are you aware that the kernel contains routines to do doubly linked lists
(InitializeListHead, InsertTailList, InsertHeadList, etc)?
--
Tim Roberts, timr@xxxxxxxxx
Providenza & Boekelheide, Inc.
.



Relevant Pages

  • Re: teaching a child - console or GUI
    ... >> Are these objects very complex, or are they really a bunch of pointers ... >> One can hold a lot of those on disk ... ... Sure they do - however since memory is finite ... lists of pointers on disk, extract files of frequent search fields in ...
    (comp.lang.pascal.delphi.misc)
  • Re: Ranting about JVMs default memory limits...
    ... Originally, 32-bit Windows split it half and half, with the user code getting 2GB and the OS getting 2GB. ... But, the OS didn't really need 2GB of address space, and so enabling "LARGEADDRESSAWARE" tells the OS that the application doesn't make any assumptions about the range of pointers and that it can pass user data addresses to the process in the first 1GB of the second 2GB of the full 4GB address space. ... Memory blocks aren't moveable, so allocations can sit in between two free blocks, limiting the size of the largest block that can actually be allocated. ... Depending on the allocation pattern, it's not hard at all to have over 1GB of virtual address space left, but not be able to allocate any single block nearly that large. ...
    (comp.lang.java.programmer)
  • Re: Help wanted - problems with heap
    ... Memory pressure, because of limited heap size. ... identified that by failures to allocate memory. ... Any pointers as to work out what is happening would be welcome. ...
    (rec.games.roguelike.development)
  • Re: How to allocate memory for a linked list of pointers in a kernel process
    ... are you sure you access memory at proper ... lists using pointers of course. ... When the kernel routines need to allocate a ... Are you aware that the kernel contains routines to do doubly linked lists ...
    (microsoft.public.win32.programmer.kernel)
  • Re: very strange pthread problem
    ... The worker threads need access to a class member function or two. ... STL vector so each index into the vector points to the list of pointers ... it's just storing the pointers to the STL lists and the vector ... Then I moved the whole thing to a single cpu Linux ...
    (comp.programming.threads)