Cockroaches often come out of cracks in walls due to moisture. That's why, in such a situation, the first thing you need to do to get rid of these insects is to repair the cracks. For this, use a good silicone sealant or plaster to seal the cracks. Also, to prevent cracks in the walls, you should prevent moisture from entering the wall.
For this, notice where the moisture is coming from. Moisture can come to the wall due to various reasons like leakage in the pipeline or stagnation of water. Therefore, to prevent moisture, clean up stagnant water, repair water pipelines, etc. Also, ensure good ventilation in the room. Use air conditioners, fans, or window exhausts to increase airflow. This also removes moisture quickly.